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.
8,335
questions
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, ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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"
...
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 ...
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"
...
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 ...
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 ...
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",
"...
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" },
...
...
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 ...
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 ...
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 -
...
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 ...
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 ...
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 ...
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" : {...
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 ...
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 ...
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 ...
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, ...
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 ...
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 ...
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
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 ...
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 "...
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
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 ...
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": [
{
"...
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::...
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 ...
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 ...
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:
...
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"...
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 ...
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 ...
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 ...
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 ...
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 ...