Questions tagged [aws-cloudformation]

For questions about CloudFormation, part of the Amazon Web Services (AWS) that provides a way to manage a collection of related AWS resources.

Filter by
Sorted by
Tagged with
38 votes
6 answers
27k views

Nested Step Function in a Step Function: Unknown Error: "...not authorized to create managed-rule"

I have a Step Function (Parent) created in a SAM/CloudFormation template that, among other things, calls another Step Function (Child). I'm following the instructions on calling Child, from Parent, ...
Matt's user avatar
  • 937
38 votes
5 answers
43k views

create folder inside S3 bucket using Cloudformation

I'm able to create an S3 bucket using cloudformation but would like to create a folder inside an S3 bucket..like <mybucket>--><myfolder> Please let me know the template to be used to ...
shiv455's user avatar
  • 7,644
37 votes
4 answers
28k views

Create AMI image as part of a cloudformation stack

I want to create an EC2 cloudformation stack which basically can be described in the following steps: 1.- Launch instance 2.- Provision the instance 3.- Stop the instance and create an AMI image ...
user avatar
36 votes
3 answers
45k views

How to specify all ports in Security group - CloudFormation

I have my CloudFormation script like this now: "SecurityGroupIngress" : [{ "IpProtocol" : "tcp", "FromPort" : "0", "ToPort" : "65535", "CidrIp" : "0.0.0.0/0" }] and ...
Steven Yong's user avatar
  • 5,364
35 votes
4 answers
39k views

How do I specify template parameters when running AWS SAM Local?

Using AWS SAM Local I can test my serverless application locally, which is awesome. I can also deploy to AWS, which apparently takes the same flags as aws cloudformation deploy, so I can pass a ...
Tomas Aschan's user avatar
  • 59.5k
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: ...
Gowtham Chand's user avatar
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 ...
Hleb's user avatar
  • 7,151
34 votes
7 answers
17k views

Incorporate existing AWS resources into a CloudFormation stack

Is there a way to incorporate existing AWS resources that were created outside of CloudFormation into an existing CloudFormation stack? I'd like to do this without having to add a new resource in the ...
BrianP's user avatar
  • 1,867
32 votes
5 answers
50k views

How do I reference cross-stack resources in the same app?

I have an app that has two stacks, both within the same region/account. One of those stacks requires the ARN of a lambda that exists in the other stack. How do I reference this? // within stackA ...
John's user avatar
  • 11.4k
31 votes
2 answers
29k views

Is it possible to execute a CloudFormation file in Terraform?

One team has already written a cloudformation template as a .yml file that provisions a stack of resources. Is it possible to leverage this file by executing it from within Terraform? Or does it have ...
user1521567's user avatar
  • 1,803
31 votes
4 answers
20k views

CloudFormation Cross-Region Reference

When you are running multiple CloudFormation stacks within the same region, you are able to share references across stacks using CloudFormation Outputs However, outputs cannot be used for cross ...
Reed Hermes's user avatar
  • 2,136
31 votes
5 answers
19k views

AWS CDK VS SDK for IaC

I recently started working with AWS and IaC, I'm using Cloudformation to provision my AWS resources, but I discovered that AWS provide both a SDK and a CDK to enable you to provision resources ...
dev.tom's user avatar
  • 519
31 votes
5 answers
35k views

How to create variable number of EC2 instance resources in Cloudformation template?

How to create variable number of EC2 instance resources in Cloudformation template, according to a template parameter? The EC2 API and management tools allow launching multiple instances of the same ...
nivertech's user avatar
  • 391
31 votes
2 answers
17k views

How to make a list item conditional in Cloud Formation template?

I have the following cloud formation template that creates a code pipeline. The pipeline has three stages: Stages: - Name: "Source" Actions: - Name: "Source" ...
Tim W.'s user avatar
  • 874
30 votes
3 answers
22k views

Cloudformation when to use getatt, ref, vs ${}

I'm trying to figure out the differences between GetAtt vs Ref vs ${}. From what I understand you use GetAtt to refer to objects within the same template only and Ref can be used to refer to ...
tmp dev's user avatar
  • 8,563
30 votes
2 answers
21k views

JMESPath JSON filter with multiple matches

I have a json block that looks a bit like this (have you guessed from AWS) { "Vpcs":[ { "VpcId":"vpc-blabla1", "OtherKey":"Value" }, { "VpcId":"vpc-blabla2", "OtherKey":"Value" ...
Sam's user avatar
  • 632
29 votes
8 answers
20k views

Cloudformation Cognito - how to setup App Client Settings, Domain, and Federated Identities via SAM template

I already have my cognito user pool cloudformation template working, and have it integrated to my api gateway. But somehow i still have to manually configure the app client settings, domain, and ...
Jeff's user avatar
  • 810
29 votes
7 answers
25k views

Create AWS Athena view programmatically

Can you create views in Amazon Athena? outlines how to create a view using the User Interface. I'd like to create an AWS Athena View programatically, ideally using Terraform (which calls ...
Algamest's user avatar
  • 1,479
29 votes
2 answers
18k views

Cannot create only IAM policy with cloudformation

I am having issue with creating IAM policy in cloudformation.But when I run it I get the error that Groups,Roles,Users is required: Here is my code: { "AWSTemplateFormatVersion": "2010-09-09", "...
Hamed Minaee's user avatar
  • 2,540
29 votes
4 answers
27k views

AWS: Cloud Formation: Is it possible to use multiple "DependsOn"?

Given i have this example template: { "AWSTemplateFormatVersion" : "2010-09-09", "Mappings" : { "RegionMap" : { "us-west-1" : { "AMI" : "ami-655a0a20" }, ... ...
SG 86's user avatar
  • 7,048
29 votes
1 answer
16k views

How to change default root EBS size in cloudformation? [AWS]

Considering there is less amount of documentation and solutions online for cloudformation I decided to address a common problem regarding changing default size of EBS volumes launched via ...
Bhargav Amin's user avatar
  • 1,157
29 votes
2 answers
20k views

How to create a cloud formation template from an existing AWS environment?

I have an existing aws infrastructure with VPC's, subnets, instances,etc. If I need to build the same infrastructure again in future is there any way to create a cloud formation template from the ...
user avatar
29 votes
3 answers
10k views

CloudFormation is waiting for NetworkInterfaces associated with the Lambda Function to be cleaned up

I have a CloudFormation stack with Lambda function inside a VPC, When trying to delete the stack, the AWS CloudFormation gets stuck for 25-30 at least, I get the following message in the events - ...
Dev1ce's user avatar
  • 5,700
28 votes
3 answers
55k views

How do I pass a list of strings as a parameter in CloudFormation?

I've got a nested CloudFormation template which accepts a number of parameters from its root template to configure it. At the moment I'm only passing simple string parameters but now I need to pass a ...
Liam Mayfair's user avatar
28 votes
2 answers
25k views

AWS cloudformation error: Template validation error: Template error: resource NotificationsTopic does not support attribute type Arn in Fn::GetAtt

I am trying to create an AWS cloudformation stack using a yaml template. The goal is to create a sns topic for some notifications. I want to output the topic arn, to be able to subscribe multiple ...
fgonzalez's user avatar
  • 3,827
28 votes
1 answer
41k views

How to reference a resource ARN in a cloudformation policy document ? (yaml)

I am trying to define a trust relationship policy document between a role and a user in cloudformation (yaml). For specifying the ARN of the user in the role's AssumeRolePolicyDocument, I want to ...
James Wierzba's user avatar
28 votes
5 answers
23k views

CloudFormation, apply Condition on DependsOn

The task that I need to do is make CDN depend on a S3 bucket. But we want to make it use the existing bucket rather than creating a new one. Here is the sample code that I am trying: "Parameters" : {...
Pandya M. Nandan's user avatar
27 votes
1 answer
19k views

How to set DynamoDB Read/write capacity mode to On-demand on CloudFormation

I've seen this site about DynamoDB On-demand and I updated my tables, created by CloudFormation, to On-demand. Now, when I try to update my Stack, I get this error: One or more parameter values ...
Pedro Arantes's user avatar
27 votes
2 answers
10k views

Difference between an Output & an Export

In CloudFormation we have the ability to output some values from a template so that they can be retrieved by other processes, stacks, etc. This is typically the name of something, maybe a URL or ...
Kirk Broadhurst's user avatar
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 ...
Sam Bantner's user avatar
27 votes
1 answer
34k views

Creating an ALB Target Group in CloudFormation

I'm trying to create an Application Load Balancer in CloudFormation, with a target group that forwards traffic to EC2 instances. Here is the relevant snippet, where ELBSubnets, ECSCluster, ...
MungeWrath's user avatar
27 votes
2 answers
8k views

AWS CDK generated resource identifiers are horrible and not readable. Any way to fix this?

Anyone, that has used AWS CDK suffers from horrible resource identifiers. Examples of Stacks/Nested Stacks names: Or examples of resource names: These identifiers are horrible to read. Is there ...
Laimonas Sutkus's user avatar
26 votes
3 answers
7k views

How to define an ECR Lifecycle Policy with CloudFormation

In order to limit the number of images in a repository, I'd like to define a Lifecycle policy. Since all the stack is defined with CloudFormation, I'd like to define this policy too. For example, my ...
Ing. Luca Stucchi's user avatar
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 - ...
ChumiestBucket's user avatar
26 votes
4 answers
8k views

Cloudformation Template format error: Every DeletionPolicy member must be a string

Hi I am trying to use the "IF" Function just like mentioned in cloud formation documentation for RDS DeletionPolicy, but for some reason it says that my function does not return a string. AWS ...
Gleeb's user avatar
  • 11k
26 votes
5 answers
19k views

AWS cloudformation: One big template file or many small ones?

I'm about to rewrite a lot of my aws deployment code to launch everything with cloudformation controlled by boto, instead of bringing up each element on its own with boto. Does anyone know if its "...
TristanMatthews's user avatar
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 ...
Joseph Astrahan's user avatar
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 ...
Hleb's user avatar
  • 7,151
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 ...
Pedro Baptista Afonso's user avatar
26 votes
4 answers
15k views

Is there a way for cloudformation to query available zones for subnet creation?

I have a cloudformation script that attempts to create a VPC, with one subnet per AZ. When I run: aws ec2 describe-availablity-zones I get 4 zones returned: "AvailabilityZones": [ { "...
chris's user avatar
  • 36.8k
25 votes
5 answers
35k views

How to specify JSON-formatted string in Cloudformation?

I have the following resource on my CloudFormation template to create a rule to run a Lambda function, from the AWS documentation: "ScheduledRule": { "Type": "AWS::...
Steven Yong's user avatar
  • 5,364
25 votes
4 answers
33k views

How to remove a resource without deleting it during a cloudformation stack update

I have a cloudformation template that creates an S3 bucket as part of a cloudformation stack. On the new version of my template, I 'm planning to migrate my application from S3 to EFS. Is there a ...
Ramiro Berrelleza's user avatar
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 ...
Ryan Fisch's user avatar
  • 2,634
25 votes
1 answer
5k views

How to require email validation in Cognito through CloudFormation?

I think I tried all properties here: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cognito-userpool.html couldn't get this box checked: My config currently: ...
Daniel Birowsky Popeski's user avatar
25 votes
2 answers
22k views

When do I need to have CAPABILITY_NAMED_IAM

I was editing my CloudFormation templates and suddenly AWS tells me I need CAPABILITY_NAMED_IAM. I am curious as to which change triggers this? What is a named IAM resource? Before I already "name"...
Jiew Meng's user avatar
  • 85.9k
25 votes
3 answers
20k views

How to get logical ID of resource with CDK?

I'm attempting to write some tests for a CDK Construct that validates security group rules defined as part of the construct. The Construct looks something like the following. export interface ...
jaredready's user avatar
  • 2,478
25 votes
1 answer
18k views

AWS::CloudFormation::Init how does it work?

We can use AWS::CloudFormation::Init to execute commands and upload files after starting an instance. But does anybody know what are the internals of this operation (from Amazon's side)? When we ...
SoYoung's user avatar
  • 315
25 votes
1 answer
28k views

aws Lambda created ENI not deleting while deletion of stack

CloudFormation creates Lambda function. When the function is executed an ENI is provisioned automatically by lambda. The ENI seems to be left in existence after function execution for to speed up ...
laxman's user avatar
  • 283
25 votes
4 answers
11k views

RDS with Cloud Formation and AZ issues

I am using cloud formation to create a setup containing an RDS instance. I am having some difficulties creating the RDS Instance on the account of the following error: DB Subnet Group doesn't meet ...
Gleeb's user avatar
  • 11k
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 ...
Jamie's user avatar
  • 1,676