All Questions
Tagged with aws-cloudformation aws-lambda
1,024
questions
90
votes
7
answers
79k
views
Specify log group for an AWS lambda?
Is there a way to specify the CloudWatch log group that an AWS lambda logs to? It seems to be generated directly from the lambda name; however, it would be especially convenient to, for example, ...
78
votes
4
answers
31k
views
Difference between SAM template and Cloudformation template
I'm finding it hard to understand the difference between SAM template and Cloudformation template. I know that SAM template can be used to define Serverless Applications like Lambda, but how does that ...
68
votes
14
answers
61k
views
How to create a new version of a Lambda function using CloudFormation?
I'm trying to create a new version of a Lambda function using CloudFormation.
I want to have multiple versions of the same Lambda function so that I can (a) point aliases at different versions - like ...
39
votes
7
answers
37k
views
AWS Lambda scheduled event source via cloudformation
I already have my lambda / roles defined in cloudformation and would love to also use it to add a scheduled eventsources ... are there any docs or examples around ?
38
votes
7
answers
50k
views
Is it possible to trigger a lambda on creation from CloudFormation template
I tried creating a set of lambdas using cloudformation. I want the lambdas to get triggered once they are created. I saw at various blogs to create a trigger to s3 or sns but none seems to be a option ...
35
votes
1
answer
25k
views
Lambda in VPC deletion takes more time
I have created a stack that lambda in VPC using cloud formation. When I try to delete the entire stack, it takes 40-45 minutes of time.
My Iam Role has the following permission:
Action: ...
35
votes
2
answers
8k
views
How to describe AWS Lambda function test events in CloudFormation template?
I describe existing AWS Lambda function in CloudFormation template and I face with the next issue. In our Lambda we configured few test events which helps us to verify some usecases (I mean ...
27
votes
3
answers
30k
views
How can I grant permission to API Gateway to invoke lambda functions through CloudFormation?
I've been all over the web searching for an answer to this.
Essentially, we're spinning up an API using Swagger, which is awesome and works great, but one thing doesn't work... When we make a call to ...
26
votes
3
answers
23k
views
"An error occurred: LogGroup - <resource name> already exists" while trying to deploy Serverless
after running sls deploy -v && sls s3deploy as I normally do, I ran into this issue:
...
CloudFormation - CREATE_FAILED - AWS::Logs::LogGroup - CallTextractLogGroup
...
CloudFormation - ...
26
votes
3
answers
13k
views
Export existing AWS Lambda and API Gateway to Cloudformation template
How to export existing configured and tested infrastructure (including AWS Lambda functions, API Gateways, ElastiCache clusters, Cloudwatch rules) to Cloudformation template?
I know about ...
26
votes
3
answers
38k
views
How can we use serverless.yml to create an AWS S3 bucket and add a file to it?
I'm wondering if it's possible to leverage serverless.yml to create a bucket and add a specific file to it during the deploy process of serverless-framework.
So far, I've been able to add the S3 ...
25
votes
3
answers
15k
views
Serverless Framework add Lambda to an Existing VPC and Subnet
Is it possible to create a Serverless Framework Lambda deployment where the Lambda is deployed into an existing VPC's SecurityGroup? I don't want the service deployment or it's stack to own an of the ...
24
votes
7
answers
20k
views
How to install external modules in a Python Lambda Function created by AWS CDK?
I'm using the Python AWS CDK in Cloud9 and I'm deploying a simple Lambda function that is supposed to send an API request to Atlassian's API when an Object is uploaded to an S3 Bucket (also created by ...
24
votes
2
answers
23k
views
Cannot fix "The provided execution role does not have permissions to call CreateNetworkInterface on EC2"
I tried the solutions in this answer but it does not work for me. I am getting the error:
The provided execution role does not have permissions to call CreateNetworkInterface on EC2 (Service: ...
24
votes
4
answers
13k
views
How do I cloudform an API gateway resource with a lambda proxy integration
I've been trying to work out how to express (in cloudformation) an API Gateway Resource that has a Lambda function integration type using the Lambda Proxy integration.
This is easy to do in the AWS ...
22
votes
2
answers
22k
views
Create a Lambda notification in an S3 bucket with CloudFormation
I'm trying to create an S3 trigger for a Lambda function in a CloudFormation Template. The S3 bucket already exists, and the Lambda function is being created.
This says it's not possible to modify ...
21
votes
6
answers
35k
views
Lambda does not have permission to access the ECR image
With the recent release of Docker Images for Lambda functions, I've decided to try out this functionality using CloudFormation.
So, the lambda below considers a docker image stored in Elastic ...
21
votes
4
answers
21k
views
aws cloudformation lambda python bad handler
I need to create aws Lambda (python) from cloudformation. The lambda function was created, but when I tried to execute the lambda, I keep getting the following error. I have tried many ways and I ...
20
votes
1
answer
17k
views
Adding lambda target role to AWS Eventbridge rule in Cloudformation fails
I am trying to create an AWS Eventbridge rule with a Lambda function as a target. I can add the rule and target fine but when I try to set the lambda permissions via RoleArn the Cloudformation stack ...
20
votes
2
answers
7k
views
Can't create a SNS Event source on a Lambda function using CloudFormation
This is the Cloudformation template code related to my problem:
"SNSTopic": {
"Type": "AWS::SNS::Topic",
"Properties": {
"TopicName": "JumpboxPresenceTopic",
"DisplayName": "Jumpbox ...
19
votes
1
answer
8k
views
How to set Lambda alarm for specific Lambda using CloudFormation?
This is the structure of CloudFormation Alarm from AWS document.
Type: "AWS::CloudWatch::Alarm"
Properties:
ActionsEnabled: Boolean
AlarmActions:
- String
AlarmDescription: String
...
19
votes
4
answers
18k
views
AWS Lambda Code in S3 Bucket not updating
I am using cloudformation to create my lambda function with the code in a S3Bucket with versioning enabled.
"MYLAMBDA": {
"Type": "AWS::Lambda::Function",
"Properties": {
"...
19
votes
6
answers
32k
views
how to connect a cloudwatch alarm to a lambda function
How do you connect an aws cloud watch alarm to a lambda function invocation?
I am programmatically adding a cloud watch alarm to the ELBs that we create as part of a cloud formation stack via AWS ...
19
votes
3
answers
24k
views
Dynamic environment variables for AWS Lambda using cloudformation template
I have to use AWS lambda in various stack of my application, thus I have created a generic cloud-formation template to create a lambda function. This template can be included in another cloud-...
18
votes
5
answers
40k
views
CloudFormation is not authorized to perform: iam:PassRole on resource
This is part of the code of my template.yml in Cloud9:
Type: 'AWS::Serverless::Function'
Properties:
Handler: index.handler
Runtime: nodejs6.10
CodeUri: .
Description: Updates records in the ...
17
votes
8
answers
37k
views
Unable to add cloudfront as trigger to lambda function
Hi I've followed this instruction try to resize image with Cloudfront and lambda@edge. When I tried to test the resized image, I keep getting the error message below:
The Lambda function associated ...
17
votes
5
answers
16k
views
CloudFormation template - Using existing IAM role in for Lambda functions
I'm trying to use an existing role (present in the AWS account) in a cloudformation template to setup a lambda function, i plan to be use this across multiple AWS accounts.
In the CF template, I'm ...
16
votes
2
answers
8k
views
AWS CloudFormation - Create Tables After RDS Instance Is Ready?
CloudFormation amateur here. Been looking online and can't find any references as to how I would go about creating my tables after my RDS instance is stood up through CloudFormation. Is it possible to ...
15
votes
2
answers
35k
views
AWS Cloudformation : Passing environmental variables as parameters to lambda functions
I am creating a cloud formation for lambda . I want to have a generic lambda script that created lambda . I am having problem injecting "Environment" parameter from outside .
I want to pass the key ...
14
votes
5
answers
19k
views
Stack is in UPDATE_COMPLETE_CLEANUP_IN_PROGRESS state and can not be updated
I'm trying to deploy a Lambda function inside Cloud9, but it is failing.
When I right-click on the function and click Deploy, I get Application deployment failed, and then a popup:
AWS ...
14
votes
1
answer
9k
views
Run Custom resource whenever i update my CFN Stack
I have a custom resource used to get the API key from API gateway and send it as a header to Cloudfront. When i am creating a stack my custom:resource is triggering since it is creating logical ID for ...
13
votes
2
answers
12k
views
Which AWS services does AWS CloudFormer support?
AWS CloudFormation offers a default stack named CloudFormer, a template creation tool. CloudFormer creates a CloudFormation template from your current AWS environment, allowing you to click which ...
13
votes
2
answers
8k
views
AWS Lambda S3 Bucket Notification via CloudFormation
I'm trying to create a Lambda notification via CloudFormation but getting an error about the ARN format being incorrect.
Either my CloudFormation is wrong or it doesn't support the Lambda preview yet....
13
votes
2
answers
22k
views
AWS Cloud Formation !Sub & !Ref functions inside AWS::Serverless::Function Policies
I have been using the !Sub function in my CloudFormation Yaml templates just fine. And when used it as an object property value it works for me
Object:
Property1: !Sub some-value-with-a-${variable}-...
12
votes
4
answers
11k
views
Function not found after manually deleting a function in a SAM CloudFormation stack
I am using sam deploy to deploy lambda function and API gateway. It works fine but it doesn't work after I manually deleted the lambda function via AWS console. I got below error:
"...
12
votes
3
answers
16k
views
How to add environment variables in template.yaml in a secured way?
When creating Lambda function through the SAM CLI using template.yaml, I have to pass few environment variables, and they shouldn't be exposed on GitHub. Is there any way I can refer the environment ...
12
votes
5
answers
15k
views
Export the Lambda ARN
I would like to export my Lambda ARN that I created using the serverless framework, as I need to use this ARN in other CF template
I defined Outputs and Export in my serverless.yml file.
resources:
...
12
votes
1
answer
8k
views
How to provide AWS API Gateway Custom Authorizer a Lambda Permission?
I have an AWS Lambda function, to which I am trying to provide permission after successfully setting it as an Authorizer.
Basically I want to achieve the following in CloudFromation -
Following is ...
11
votes
2
answers
7k
views
Change lambda from supported runtime to docker image
I have a lambda which was created and deployed with CloudFormation. The lambda, as of now, uses the supported .NET Core 3.1 runtime but I want to use the "unsupported" .Net Core 5 so I have ...
11
votes
2
answers
18k
views
Upload local file on parameter ZipFile AWS::Lambda::Function
I've a CloudFormation template with AWS::Lambda::Function resource, and I'm trying to upload a local zip file as code, but It's not uploading. The Lambda function is created without code files.
...
11
votes
2
answers
6k
views
How do we access and respond to CloudFormation custom resources using an AWS Lambda function written in Java?
I have am AWS Lambda function written in Java that I would like to use as part of a response to an AWS CloudFormation function. Amazon provides two detailed examples on how to create a CloudFormation ...
11
votes
3
answers
26k
views
AWS CloudFormation stack stuck in the state UPDATE_ROLLBACK_IN_PROGRESS
I wanted to update my stack. The stack failed with error Function not found: arn:aws:lambda....
And stack in status UPDATE_ROLLBACK_IN_PROGRESS more than 5 hours. How do I stop this process?
10
votes
2
answers
13k
views
AWS lambda: No module named 'cfnresponse'
I have deployed an AWS lambda which contains:
import json
import boto3
import cfnresponse
import urllib.request
from botocore.exceptions import ClientError
def lambda_handler(event, context):
...
...
10
votes
2
answers
8k
views
Update cloudformation stack from aws cli with SAM transform
When attempting to update a cloudformation stack in the aws cli:
aws --profile dev cloudformation update-stack --stack-name mystackname --template-body file://events-list.yaml
I get the following ...
10
votes
1
answer
2k
views
Serverless-framework, when does the API Gateway URL change?
I am using serverless-framework to deploy a lambda with http endpoints on AWS. This works fine and returns a API Gateway endpoint.
I wanted to know under what scenarios does the endpoint URL change. ...
10
votes
3
answers
10k
views
How to set Lambda concurrency limit in CloudFormation template
I want to limit number of simultaneously running lambdas through cloudformation configuration file. I tried to search for it, but had no luck. On the documentation page there is not information about ...
10
votes
1
answer
7k
views
Multiple Lambda functions from the sam.yml file
Still waiting for actual AWS support for this:
https://github.com/aws-samples/aws-serverless-samfarm/issues/5
How is this supposed to work?
My use case is I have an API Gateway fronted lambda that ...
10
votes
3
answers
7k
views
Updating aws lambda layer dependencies
The situation is that I have a load of aws lambda functions (using node js 8.10) that all do something very different and they're all deployed using CloudFormation.
They all share a few functions ...
10
votes
2
answers
5k
views
how to enable api gateway logs via cloud formation template (serverless.yml)?
I want to enable api gateway logs for my api gateway which is the wraparound for my lambda function.
service: myservice
provider:
name: aws
runtime: python3.6
stage: ${opt:stage}
region: ${...
10
votes
0
answers
5k
views
AWS Lambda environment variable is not updated when execute aws cloudformation deploy
I want to update AWS Lambda environment variable.
The function is defined in SAM. Environment variable refers Parameter.
Like this.
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-...