All Questions
Tagged with aws-cloudformation serverless-framework
271
questions
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 ...
26
votes
5
answers
23k
views
Serverless Error, CloudFormation cannot update a stack when a custom-named resource requires replacing
I have the following error.
Serverless: Operation failed!
Serverless Error ---------------------------------------
An error occurred: phoneNumberTable - CloudFormation cannot update a stack when a ...
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 ...
19
votes
6
answers
17k
views
Serverless: Deplyment error S3 Bucket already exists in stack
I am trying to deploy a serverless project which has s3 bucket creation cloudformation in the serverless.yml file, but the problem is when I tried to deploy, it says the s3 bucket already exists and ...
14
votes
2
answers
4k
views
How to get the target domain name of a custom domain for Regional AWS API Gateway in Cloudformation?
I'm trying to create a multi-region serverless application on AWS. I've followed the instructions given here. I'm using Serverless framework, which uses Cloudformation scripts for creating all the ...
13
votes
2
answers
5k
views
Serverless Framework: Output compiled CloudFormation
I am using the serverless framework for a lambda project. We need to be able to access the cloudformation directly to meet with our standards for other projects. How can I view the full CloudFormation ...
13
votes
2
answers
8k
views
How to reference the latest Stream of a DynamoDB table in a Cloudformation template
I am writing a plugin for the serverless framework, which references a DynamoDB Stream by its ARN. I can construct the DynamoDB tables ARN with the information I have at hand, but I don't know the ...
13
votes
1
answer
1k
views
AWS SAM : Nested Stacks, Referring to API gateway from the Root stack
I want to split my SAM application into multiple parts.
I want to create a API ( AWS::Serverless::Api ) in the root stack.
I am creating lambda functions in my child stacks, where I want to give the ...
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:
...
11
votes
4
answers
4k
views
Need to configure serverless resource output to get api gateway api id
I have a serverless project that is creating an API Gateway API amongst other things. One of the functions in the project needs to generate a URL for an API endpoint.
My plan is to get the API ID ...
10
votes
3
answers
10k
views
Create CloudFormation stack without resources
I am using Terraform for most of my infrastructure, but at the same time I'm using the serverless framework to define some Lambda functions. Serverless uses CloudFormation under the hood where I need ...
10
votes
4
answers
9k
views
Is there a way to rename a cloudformation stack name?
I have a cloudformation stack (which is generated from stack_master), Resources are already created but I would like to put it into serverless framework. I have already added the resources section but ...
10
votes
10
answers
40k
views
Unable to validate the following destination configurations (S3 to SQS)
I am trying to set up a workflow with serverless that creates a new S3 bucket, a new SQS queue and when an object is created in the S3 bucket, puts a messages on the queue and spins up a lambda once ...
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
5k
views
CloudFormation AWS::CertificateManager::Certificate automated certificate validation
According the AWS docs at here and here I should be able to automate a certificate creation and validation using cloudformation. Apparently when you specify a HostedZoneId in the ...
10
votes
3
answers
1k
views
Serverless Framework: ways to achieve full "infrastructure as code"?
I've followed an excellent guide (Serverless Stack) that creates a typical CRUD serverless infrastructure with a react frontend. It's using the Serverless Framework for AWS.
What I don't like is that ...
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: ${...
9
votes
1
answer
2k
views
Amazon DynamoDB Attribute Type with CloudFormation
I'm working on a Serverless web application and I'm trying to create a CloudFormation YAML template for a DynamoDB table. The documentation says that each attribute in the table should follow the ...
9
votes
5
answers
5k
views
Is there no setting for AWS API Gateway REST API to disable execute-api endpoint in CloudFormation template?
I have setup an API Gateway (v1, not v2) REST API resource using CloudFormation template. Recently I have noticed that the default execute-api endpoint is also created, which I can disable in the ...
9
votes
1
answer
9k
views
How to get the latest lambda version in cloudformation yml?
I'm trying to reference an edge lambda for cloudfront distribution in cloudformation.
What I have now is:
LambdaFunctionARN:
Fn::GetAtt: [BasicAuthLambdaFunction,Arn]
But I ...
9
votes
1
answer
1k
views
Referencing an entire property in multiple serverless files - [object Object] does not exist
One of the biggest challenges that I've faced using serverless is in deploying AWS Lambda functions in a micro-service fashion (Each lambda individually - I've already tried individual packages, ...
8
votes
2
answers
2k
views
Why does AWS Lambda CFN S3-response returns 403 upon Delete event?
I'm using serverless to deploy an application where I use a Custom Resource to migrate a RDS database.
Everything works while I deploy, but when I delete the stack the Custom Resource timeouts after ...
8
votes
1
answer
2k
views
Circular dependency between resources: CognitoUserPool and environment
I am getting an error when i try to use Ref: to AWS::Cognito::UserPool in lambda environment when the lambda is bound to events from cognitoUserPool
This is the error
The CloudFormation template is ...
7
votes
4
answers
12k
views
!ImportValue in Serverless Framework not working
I'm attempting to export a DynamoDb StreamArn from a stack created in CloudFormation, then reference the export using !ImportValue in the serverless.yml.
But I'm getting this error message:
unknown ...
7
votes
4
answers
4k
views
AWS Cognito - How to create pool allowing sign up with email address, using CloudFormation?
I am attempting to create a UserPool using CloudFormation syntax, but I am unable to find which property I need to set in order to create the pool with email address sign up. How do I specify this?
...
7
votes
1
answer
1k
views
IdentityPool Creation with CloudFormation
I'm attempting to follow along with a tutorial located at http://serverless-stack.com/chapters/create-a-cognito-identity-pool.html for identity pool creation and document the creation by using ...
7
votes
1
answer
6k
views
Why do I get the error "Code uncompressed size is greater than max allowed size of 272629760" only for some deployment targets?
As part of an AWS CodePipeline in an AWS CodeBuild action I deploy resources created with the Serverless Framework to a "UAT" (user acceptance testing) stage.
The pipeline runs in its own ...
7
votes
1
answer
4k
views
How to use AWS SSM parameter store values in Cloudformation template conditionals?
I have configured a key value pair in the AWS SSM parameter store UI as my-ssm-key = ssm-value.
I have the following YAML template for CF built on Serverless:
service: redirect-test
provider:
...
6
votes
1
answer
7k
views
How to configure a Serverless S3 bucket resource to use a CORS AllowOrigin set to the http endpoint of its function
I'm using Serverless to create a web application that serves its static content, e.g. a web font, from a S3 bucket. The S3 bucket is configured as a resource in my serverless.yml file. Its CORS ...
6
votes
4
answers
15k
views
"Stack with id X does not exist" on all sls commands after successful sls remove
After successfull sls remove all sls commands fail with
Stack with id X does not exist
Checked that stack, additional stacks and S3 deployment bucket were deleted. Tried removing .serverless/, ...
6
votes
3
answers
14k
views
Cloudformation - how to set filter policy of SNS subscription in code?
UPDATE: Cloudformation now supports SNS Topic Filters, so this question is not relevant anymore, no custom plugins or code is needed.
I am building a system with a number of SNS topics, and a number ...
6
votes
1
answer
4k
views
How to migrate dynamodb data on major table change?
During development structures and requirements change. Key and index settings need to be changed, that might break incremental table update. So my solution so far is to delete the table and recreate ...
6
votes
2
answers
4k
views
Certificate issue when using serverless and serverless-domain-manager with custom domain
I'm trying to set up a custom domain for my API Gateway and Lambda function.
I registered a domain with route53. Ex: myDomainToTestApi.net
I also created the certificates for: myDomainToTestApi.net, ...
6
votes
2
answers
4k
views
How can I write nested IF in serverless.yml using yaml format file while using it for cloud formation?
I'm trying to access secrets created in secrets manager(https://aws.amazon.com/secrets-manager/) via SSM (Systems Manager- https://docs.aws.amazon.com/systems-manager/latest/userguide/systems-manager-...
6
votes
3
answers
4k
views
How do I debug an 's3:CreateBucket Access Denied' from CloudFormation
I have a CloudFormation Stack created from a Serverless YAML file.
One of the resources is this:
"S3BucketWebRoot": {
"Type": "AWS::S3::Bucket",
"Properties": {
"BucketName": "...
5
votes
3
answers
8k
views
How do you "DependsOn" a Lambda function from a CFN resource?
In Serverless, I am creating an AWS::Lambda::Permission CFN resource that allows Cognito to invoke a Custom Message Lambda Handler.
AWS::Lambda::Permission depends on the lambda. How do I ensure that ...
5
votes
4
answers
8k
views
How do you deploy cloudformation with a lambda function without inline code?
the lambda function size is over 4096 characters, so I can't deploy lambda function as inline codes in cloudformation template.
(https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-...
5
votes
4
answers
14k
views
Serverless CloudFormation template error instance of Fn::GetAtt references undefined resource
I'm trying to setup a new repo and I keep getting the error
The CloudFormation template is invalid: Template error: instance of Fn::GetAtt
references undefined resource uatLambdaRole
in my uat ...
5
votes
2
answers
9k
views
Reference function from within serverless.yml
I have several AWS lambdas running, supported by the Serverless Framework. I need one lambda (called lambdaOne) which will call a second lambda (called lambdaTwo) using AWS' javascript sdk. The issue ...
5
votes
3
answers
4k
views
Configuring Cognito User Pool to send emails with SES at ap-southeast-2
I have the following cloudformation template (it is part of a serverless.yml template) to create a Cognito UserPool that sends e-mails using SES.
I am deploying my serverless project on ap-southeast-...
5
votes
5
answers
1k
views
Serverless Framework - Two services under one APIGW endpoint
If I have two services, 'Users' and 'Products', each with several functions with endpoints defined for each one (as any traditional API would), is it possible for them to be organised separately in a ...
5
votes
2
answers
730
views
How to access plugin output in serverless.yml of Serverless Framework?
Context: to achieve full "infrastructure as code", I want to codify the process of requesting a SSL certificate using certbot, validating a domain using DNS TXT records, uploading the certificate to ...
4
votes
3
answers
6k
views
Cloud Formation Set RDS Endpoint to Route53 CName Record
Below is an example cloud formation file in YAML format. The idea is to make the Route53 Record depend upon creation of the RDS Database and then once its created get the value from the endpoint of ...
4
votes
3
answers
4k
views
Giving OriginAccessIdentity reference in CloudFormation or serverless.yml
I want to have a CloudFront distribution with access to a private S3 bucket. For that, I have to create an origin access identity. Manually, I can do that using the AWS console, but I wanted to create ...
4
votes
2
answers
3k
views
How can I ref API gateway endpoint in serverless?
I am using serverless.yml as the infra. framework. I create a lambda with a API gateway like below code:
functions:
create:
handler: posts.create
events:
- http:
path: posts/...
4
votes
2
answers
2k
views
I can't connect mysql client to RDS through VPN
I've been really struggling to use AWS RDS. All networking configuration things is a really pain in the back since I have no skills in networking and I don't like it either.
My goal is to create my ...
4
votes
1
answer
427
views
How do I connect to an RDS defined under "Resources" in serverless.yml from a Lambda function?
Say I have a section in my serverless.yml like this:
resources:
Resources:
RDSCluster:
Type: AWS::RDS::DBCluster
Properties:
MasterUsername: SomeUserName
...
4
votes
2
answers
886
views
Serverless Framework - Get API Gateway URL for use in tests
I'm using the Serverless framework, and I want to be able to reference my API Gateway URL in my acceptance tests.
My test environment is regularly destroyed and then recreated, so hardcoding a URL ...
4
votes
4
answers
9k
views
CloudFormation S3 NotificationConfiguration to SQS
I'm new to CloudFormation and currently trying to send a S3:ObjectCreated to a specific SQS Queue.
The setup is in the Serverless Framework with Resources defined in CloudFormation. The problem is ...