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,333
questions
16
votes
5
answers
30k
views
Fix CORS "Response to preflight..." header not present with AWS API gateway and amplify
I've been struggling so long with the error below. I've tried so many tutorials and stackoverflow answers and none of the solutions fixes my problem.
Access to XMLHttpRequest at
'https://xxx' ...
16
votes
3
answers
8k
views
How to alias a domain name to an Elastic Beanstalk Environment using CloudFormation?
What is the correct Route 53 CloudFormation configuration to alias sub-domain names to an Elastic Beanstalk Environment ELBs?
I have copied the HostedZoneIds from the Amazon Route 53 Hosted Zone ID ...
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 ...
16
votes
4
answers
10k
views
Is it possible to statically specify AWS::StackName inside a cloudformation template?
Is it possible to statically specify AWS::StackName inside a cloudformation template? Or can this only be specified as a parameter when you run the template?
As far as I understand, this value can ...
16
votes
4
answers
8k
views
Updating dependent stacks
I have the stack called stack-layer, which exports an ARN of a Lambda layer, and another stack called stack-lambda, which contains a Lambda, which references that Lambda layer.
When I try to update ...
16
votes
2
answers
13k
views
Cloudformation template error - Template validation error: Template format error: Every Mappings member Type must be a map
I have a cloudformation template.
It should create an EC2 instance, change the Adminstrator password and rename the server.
I am passing couple of parameters to the stack template. When I run it, ...
15
votes
1
answer
59k
views
AWS CDK - role and policy creation
How can I translate this CloudFormation to CDK (JavaScript or Java)? I was trying to do it, but this is the first time that I work with CDK and I'm not sure how to do it.
...
15
votes
3
answers
10k
views
How to set multiple certificates for AWS::ElasticLoadBalancingV2::Listener
Hi I have problem setting multiple certificates for ALB listener.
Here is fragment of my CF template:
DiscoveryListenerHTTPS:
Type: AWS::ElasticLoadBalancingV2::Listener
DependsOn:
- ...
15
votes
2
answers
5k
views
How to get Elastic Container Repository URI from Cloud Formation?
I'm trying to create an Elastic Container Service (ECS) setup from Cloud Formation.
However I don't want the ECS repository to have the ugly autogenerated URI:
111111111.dkr.ecr.us-east-1.amazonaws....
15
votes
1
answer
8k
views
Conditionally create CodePipeline actions based on CloudFormation conditions
Enable / disable sections of a CloudFormation for CodePipeline using Conditionals:
This creates a manual notification action once staging has been built and passed Runscope tests:
- InputArtifacts: [...
15
votes
2
answers
36k
views
Passing multiple parameters from external file to cloudformation template and using values with ref
I am getting following error when trying to create a cloudformation stack using below cli command.
aws cloudformation create-stack --stack-name subodh-local-stack --template-url s3URL/template.json --...
15
votes
5
answers
17k
views
AWS CloudFormation template: Is it possible to add many CidrIp as a list?
I want to create the inbound rules of a security group in a cloud formation template. I want to open the 3306 port from many different IPs.
"SecurityGroupIngress": [
{
...
15
votes
3
answers
4k
views
How to set user name and group name in IAM using CloudFormation?
I created a CloudFormation template and I wanted to create IAM user, to do that I used this JSON string:
"CFNUser" : {
"Type" : "AWS::IAM::User",
"Properties&...
15
votes
5
answers
15k
views
How do I assign a created SecurityGroup to an ELB from CloudFormation?
I've got a CloudFormation script that generates a SecurityGroup and an ELB; I'm trying to reference the SecurityGroup in the ELB creation; here's the resources bit:
"ELBSecurityGroup" : {
...
15
votes
1
answer
9k
views
Automatically set ListenerRule Priority in CloudFormation template
I have a CloudFormation template that contains an Application Load Balancer ListenerRule. One of the required properties of a ListenerRule is its Priority (a number between 1 and 50000). The priority ...
15
votes
4
answers
12k
views
How to perform mathematical operations in CloudFormation?
Is it possible to perform some sort of mathematical operation in a CloudFormation template?
There are two areas that I've encountered where this would be useful:
Setting IOPS which needs to be a ...
15
votes
3
answers
8k
views
Set API Key to be required for AWS ApiGateway endpoint (Swagger import)
I try to define my AWS Api Gateway infrastructure using Swagger/OpenAPI. Everything is working so far, however I have problems enabling the need for an API-Key for my endpoints.
My Swagger file looks ...
15
votes
4
answers
22k
views
Referencing AWS Parameter Store's Secure String in CloudFormation template
Stuck with the usage of SecureString from AWS Parameter Store. I am trying to refer to the database password as:
DatabasePassword:
Type: AWS::SSM::Parameter::Value<SecureString>
NoEcho: ...
15
votes
2
answers
17k
views
How can I disable rollback on failure in my template?
I'm working on a CloudFormation template, and an update is failing to apply. I'd like to set the stack option Rollback on Failure to "No" in order to keep the resources around for debugging. How can I ...
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 ...
15
votes
3
answers
3k
views
Set IAM Role Description
In the AWS Console there is an option to set a description for an IAM Role. How do you do this with CloudFormation? The documentation does not state how to do this. So far I have tried.
Resources:
...
15
votes
5
answers
8k
views
AWS SAM API with Cognito User Pools authorizer
How can I create an API with AWS SAM that does authorization using Cognito User Pools authorizer?
Theres AWS::ApiGateway::Authorizer. But ...
{
"Type" : "AWS::ApiGateway::Authorizer",
"...
15
votes
2
answers
4k
views
What is best way to create invalidation after cloud formation created cloud front?
I am creating a completely serverless solution which will create an s3 bucket and CloudFront too. Using cloud formation template from bitbucket pipeline
I also want to create invalidate for ...
15
votes
2
answers
5k
views
Configuring Cognito user pool to send emails with SES
This morning, I noticed an alert in my user pool settings that I hadn't noticed before:
I looked at the settings screen and there's a radio button:
I already have a from address. How do I set that ...
15
votes
2
answers
4k
views
Reuse list of CloudFormation tags
I have a rather complex set of CloudFormation templates that I use for provisioning the different environments of our infrastructure. However I recently got the request to tag the created resources ...
15
votes
1
answer
3k
views
determine required permissions for AWS CDK
I'm working with AWS CDK and every time I go to create a new resource (CodePipeline, VPC, etc) I end up in the same loop of...
try to deploy
"you are not authorized to foo:CreateBar"
update IAM ...
15
votes
1
answer
13k
views
How do I restore RDS snapshot into a cloudformation?
I want to restore an RDS instance from a snapshot and have it replace an instance in a cloudformation.
Let's say I have one EC2 instance connected to one RDS instance in a cloud formation and I want ...
15
votes
3
answers
19k
views
pull access denied for Amazon ECR, repository does not exist or may require 'docker login'
I have an image in an Amazon ECR Repository called workshop
I have a Dockerfile to pull that image
CodeBuild should build the new image from Dockerfile
Problem:
pull access denied for xxxxxxxxxxx....
15
votes
5
answers
6k
views
How to name an Auto Scaling Group in a CloudFormation template?
I have a CloudFormation template that creates an auto scaling group (among other things). How can I give the auto scaling group a name in the template?
The AWS docs do not mention anything (http://...
15
votes
1
answer
4k
views
What is the difference between volume and blockdevicemapping tags in EC2 CloudFormation
I understand that AWS::EC2::Volume resource type creates an EBS volume.
What exactly is the purpose of BlockDeviceMappings property in EC2 then?
How can I create multiple volumes in EC2 using AWS ...
15
votes
1
answer
8k
views
how to use ImportValue in parameters?
As I knew, I can use ImportValue to reference value from another cloudformation stack in part of Resources.
NetworkInterfaces:
- GroupSet:
- Fn::ImportValue:
Fn::Sub: "${...
15
votes
4
answers
7k
views
Cloudformation KeyValuePair List as a parameter
When creating ECS infrastructure we describe our Task Definitions with CloudFormation. We want to be able to dynamically pass environment variables as a parameter to the template. According to the ...
15
votes
1
answer
7k
views
How do I identify what IAM permissions are required for AWS CloudFormation?
I want to use CloudFormation. package and deploy functions but how do I go about determining what IAM permissions are required to run these?
In general, how do I determine what permissions are ...
14
votes
4
answers
21k
views
CloudFormation - Enable TTL for DynamoDB Create Table
I'd like to enable TTL for my newly-created-table via CloudFormation. I've tried the following to no avail:
{
"Resources" : {
"mytable" : {
"Type" : "AWS::DynamoDB::Table",
"...
14
votes
2
answers
9k
views
Declaring an IAM Access Key Resource by CloudFormation
I created a user in my template with an access key:
"MyAccessKey" : {
"Type" : "AWS::IAM::AccessKey",
"Properties" : {
"UserName" : { "Ref" : "User12" }
}
}
I need to get the access ...
14
votes
3
answers
10k
views
Converting Yaml cloudformation template to Json
I can't figure out how do I convert the below section of my yaml cloudformation template to a json template. Can anyone please guide me here.
Tags:
- Key: Name
Value: !Join
- ''
...
14
votes
3
answers
9k
views
S3 Creation CloudFormation results in 400 Bad Request
I have this problem when creating S3 bucket using CloudFormation. I get a 400 Bad request. Would appreciate if anyone can help.
aws cloudformation deploy --profile DEV --stack-name testBucket --...
14
votes
7
answers
28k
views
Dynamic References to Specify Secret Manager Values in AWS Cloudformation
Is there anyway we can pass dynamic references to Secret Manager to AWS Launch Config User Data?
Here is the code snippet I tried:
"SampleLaunchConfig": {
"Type": "AWS::AutoScaling::...
14
votes
3
answers
5k
views
Is CloudFormation idempotent?
I read in many places on internet that CloudFormation is not idempotent, but I cannot find any example that proves this fact.
Could you please provide me an example that runs a resource to prove ...
14
votes
2
answers
4k
views
AWS AutoScalingGroup HealthCheckType 'ELB' considers instance "InService" prematurely
I'm trying to get AutoScalingRollingUpdate to work on my autoscaling group, by bringing online new instances, then only once the new instance(s) are accepting traffic, terminating the old instances. ...
14
votes
4
answers
18k
views
Is it possible to get a VPC Id using AWS Cloud Formation?
Is it possible to obtain a VPC Id using Cloud Formation JSON?
Something like:
{ "Fn::GetAtt" : [ "MyVPCName", "VPCId" ] }
14
votes
3
answers
6k
views
How to transform a Serverless Application Model (SAM) template to Cloudformation?
From this answer I understand that SAM is a transform of Cloudformation.
Is there a way to get the transformed Cloudformation template from a SAM template via the console, CLI, or another way?
14
votes
2
answers
10k
views
AWS-CDK: Passing cross-stack references props between multi region (cross-region) stacks in AWS- CDK
I have to deploy one stack, let's call it the parent stack in one region
Them a second stack(child) needs to be deployed, in another region.
The region of the second stack(child stack) can not ...
14
votes
2
answers
10k
views
Non-Windows instances with a virtualization type of 'hvm' are currently not supported for this instance type : [AWS Cloudformation]
I am trying to create a an t2.micro ec2 instance with amazon linux as os using cloudformation . Following is the json file (parts that matter).
"FileName" :{
"Type" : "String",
"...
14
votes
3
answers
49k
views
AWS IAM Cloudformation YAML template errror: 'null' values are not allowed
I am working on a Cloudformation template for an IAM role that grants cross account read only access. It uses a managed policy for Readonly access as well. So far, I've resolved several errors, but ...
14
votes
2
answers
8k
views
The DB instance and EC2 security group are in different VPCs, cloudFormation error
I want to automate the process of creating RDS. I would like to create RDS Aurora.
When deploying the application, stack cloudFormation is validated and I have an error:
An error occurred: ...
14
votes
3
answers
61k
views
Cloudformation: Error: Member must have length less than or equal to 20
I'm using this CloudFormation template to create a Cognito User Pool:
{
"AWSTemplateFormatVersion": "2010-09-09",
"Description": "Template creates AWS Cognito UserPool.",
"Resources": {
...
14
votes
2
answers
16k
views
Cloudformation stack stuck in UPDATE_IN_PROGRESS
My cloudformation stack that has been normally getting updated in a couple minutes keeps getting stuck. ECS seems to get stuck sometimes waiting for a service to be healthy, but the service came up ...
14
votes
2
answers
7k
views
cfn-init for cloudformation launchtemplate
How do you use cfn-init within a LaunchTemplate? This is for EC2 instances, in an autoscaling group, for an ECS cluster.
Where does the Metadata section for the instance go and what is the --resource ...
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 ...