All Questions

Filter by
Sorted by
Tagged with
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
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
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
24 votes
1 answer
22k views

Can I use "Fn::Join" in "Parameters" of AWS Cloudformation json template

I want to use in Parameters of Cloudformation json template shortcut of some Policy/Loadbalancers tags name, like that: "SomeScalingGroupName": { "Type": "String", "Default": {...
muzafarow's user avatar
  • 926
21 votes
5 answers
30k views

AWS Cloudformation- How to do string Uppercase or lowercase in json/yaml template

I am working on AWS CloudFormation and I created one template in which I asked user to select Environment. On the basis of selected value I created the resources. User have to select between DEV, QA, ...
Vikramsinh Gaikwad's user avatar
18 votes
3 answers
14k views

Trying to pass parameters from Master to child template

I'm trying to pass list parameters from master to child template, however I'm running into two errors.. These are my current parameters on the master template. "Parameters": { "ELBSubnets": { ...
Mo Ali's user avatar
  • 627
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, ...
jason's user avatar
  • 407
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" ] }
lrepolho's user avatar
  • 971
8 votes
3 answers
5k views

AWS CLI- What is the syntax for assigning multiple values on a parameter

For example, I have this CF template that ask for these parameters ----- cftemplate.yaml ----- ... Parameters: **Subnet: Description: Subnet for the Instance Type: 'AWS::EC2::Subnet::Id' ...
darren's user avatar
  • 83
6 votes
2 answers
6k views

How to run AWS ECS Task with CloudFormation overriding container environment variables

I was searching a way to run ecs task. I already have a cluster and task definition settings. I just wanted to trigger a task using CloudFormation template. I know that I can run a task by clicking on ...
Hassan Hashmi's user avatar
6 votes
1 answer
20k views

Template error: instance of Fn::GetAtt references undefined resource

I have this cloudformation template : "InstanceProfileProd": { "Type" : "AWS::IAM::InstanceProfile", "Properties": { "Path": "/", "Roles" : [ { "Ref" : "InstanceRole"} ] } }, "...
JavaQueen's user avatar
  • 1,175
5 votes
1 answer
1k views

How to set a dynamic RoleMappings key for a IndentityPoolRoleAttachment in CloudFormation

I am building a stack to initialize a Cognito installation. As part of this I have setup user groups with associated roles. I need to set the Choose role from token option, allowing identities to use ...
AkkarinZA's user avatar
  • 591
4 votes
3 answers
9k views

userData are not getting executed after launching the instance by cloudformation

I created a AWS cloudformation, which creates a launch configuration and an autoscaling group. In the user Data in the launch Config I have configured the file system mount target, and I installed the ...
Souad's user avatar
  • 4,976
4 votes
1 answer
8k views

Error in the policyName when creating IAM Role by cloudformation

This is the role snippet: "InstanceRole": { "Type": "AWS::IAM::Role", "Properties": { "AssumeRolePolicyDocument": { "Version" : "2012-10-17", "Statement": [ { "Effect": "...
JavaQueen's user avatar
  • 1,175
4 votes
1 answer
2k views

How to make a whole object in CloudFormation templates optional?

I'm making a Lambda function via CloudFormation template, and I'd like to make it optional to enter the information for the VpcConfig property. I've found articles like this one on how to make ...
David's user avatar
  • 1,650
4 votes
1 answer
8k views

Pass stack tags to nested stack in Cloudformation

I'm easily able to pass parameters to a Nested Cloudformation Stack using AWS::CloudFormation::Stack, including referenced values: "MyNestedStack" : { "Type" : "AWS::CloudFormation::Stack", "...
lantrix's user avatar
  • 451
4 votes
1 answer
3k views

Use Route53 template in cloudformation with Cloudfront

"DNS": { "Type": "AWS::Route53::RecordSet", "Properties": { "HostedZoneId" : "Z058101PST6709", ...
shubham kamboj's user avatar
4 votes
1 answer
3k views

CloudFormation: Unresolved resource dependencies [Ec2Instance] in the Outputs block of the template

I am trying to create a EC2 instance using cloudFormation template. I have written below JSON for this and trying to upload json using option in CloudFormation "Upload a template to Amazon S3". But ...
vickey99's user avatar
  • 187
4 votes
1 answer
4k views

retrieve the cloudformation stack name from the lambda function

I invoke a lambda function from a custom resource in cloudformation template. This custom resource has a property : the name of the cloudformation stack. I need this property value in the lambda ...
Souad's user avatar
  • 4,976
4 votes
1 answer
613 views

CloudFormation Template - any way to get a Spot-Fleet-Request ID?

I'm attempting to create a single template that creates the following: AWS::EC2::SpotFleet resource 2 AWS::ApplicationAutoScaling::ScalingPolicy resources (scale up, scale down) Initially, my ...
KungFuBilly's user avatar
4 votes
1 answer
22k views

MalformedPolicyDocumentException when creating AWS::KSM::Key

I'm trying to create a KSM key to use it in the S3 service, but I get the MalformedPolicyDocument exception. Here is the resource: "CustomerMasterKey":{ "Type" : "AWS::KMS::Key", "Condition" : "...
Souad's user avatar
  • 4,976
4 votes
0 answers
3k views

Docker Dynamic environment variable in ECS Task Definition container json

Currently we are working on a migration resilient project where we choose AWS ECS as a container orchestration choice. Here we got a interesting problem where we are trying to get a unique value for a ...
prasanth meenapalli's user avatar
3 votes
5 answers
9k views

If it possible connect Loadbalancers DNSname to Route53 using AWS Cloudformation template?

What I trying to connect is Loadbalancer DNS name to to Route53. Lets look on example. Here is Loadbabancer from template in Resource: "RestELB" : { "Type" : "AWS::ElasticLoadBalancing::...
muzafarow's user avatar
  • 926
3 votes
2 answers
6k views

AWS CloudFormation User Data \; and new lines (JSON)

I am trying to create a CloudFormation EC2 deployment where a webserver is automatically deployed. My current setup is as follows: { "AWSTemplateFormatVersion" : "2010-09-09", "Description" :...
PandaPlaysAll's user avatar
3 votes
2 answers
1k views

Is there a way to populate an Amazon DynamoDB table from a CloudFormation template?

I need to create a DynamoDB table were one of the attribute values its passed as a parameter in a CloudFormation template: The DynamoDB table should look like this: PhoneNumber | OrderNumber ...
gcg27's user avatar
  • 77
3 votes
1 answer
593 views

How do you conditionally change a string value to a number in JQ?

I am pulling a secret from SecretsManager in AWS and using the resulting JSON to build a parameters JSON file that can pass this on to the cloud formation engine. Unfortunately, SecretsManager stores ...
KSS's user avatar
  • 971
3 votes
2 answers
2k views

Getting error in adding SSL certificate in CloudFront using CloudFormation (needs to be specified)

{ "AWSTemplateFormatVersion" : "2010-09-09", "Parameters": { "AlternateDomainNames": { "Description": "CNAMEs (alternate ...
shubham kamboj's user avatar
3 votes
1 answer
2k views

AWS CloudFormation chaining functions

I have a template which is a Master Stack for our product. I'm in the process of changing all templates from JSON to YAML, employing the new "!if" type functionality. I originally had the troublesome ...
troz's user avatar
  • 175
3 votes
1 answer
600 views

cloudformation failed to create subnets

I was trying to run a code and i had this error but cant identify the problem. i got the error message The CIDR '10.0.1.0/24' conflicts with another subnet (Service: AmazonEC2; Status Code: 400; Error ...
Nah Cassie's user avatar
3 votes
1 answer
352 views

Value of property QueueConfigurations must be of type List

I am trying to write SQS triggers for my S3 bucket. I am running into an error saying "Value of property QueueConfigurations must be of type List." Is there something wrong with my ...
Claire Le's user avatar
3 votes
1 answer
6k views

MalformedPolicyDocument error while creating an IAM Policy

I'm trying to create a managed policy by AWS CLI: POLICY=' { "Version":"2012-10-17", "Statement": [{ "Effect":"Allow", "Action": [ "cloudformation:*" ], "Resource":"*"...
Souad's user avatar
  • 4,976
3 votes
1 answer
2k views

Can't invoke lambda function by a custom cloudformation resource

I am creating a cloudformation template, that creates a DynamoDB table. I want to put the values of the parameters of the template inside the DynamoDB table. To do so, I created a lambda function that ...
Souad's user avatar
  • 4,976
3 votes
2 answers
3k views

How to add gitlab user defined variables in json file while deploying aws?

I am deploying a aws stack using gitlab -- using the below code in .gitlab-ci.yml file. script: - | aws cloudformation create-change-set \ --change-set-type UPDATE \ --...
user13085393's user avatar
3 votes
1 answer
823 views

How to know how many Mount targets to create by Cloudformation

I create by cloudformation an EFS in a VPC, this VPC contains few EC2 instances. I need to create as well mount targets for each subnet. This cloudformation template can be executed in different AWS ...
Souad's user avatar
  • 4,976
3 votes
0 answers
411 views

Importing files into pyplates

I'm busy experimenting with pyplates to create AWS CloudFormation JSON templates. I am rather new to python programming and I've run into an issue I'm not sure how to solve. The CF templates can get ...
Marcus's user avatar
  • 51
2 votes
2 answers
6k views

CloudFormation template file -- how to use ref function in the middle of a string to reference a parameter

How do you dereference a parameter in the middle of a string? I have a JSON Cloudformation template file that takes a parameter for a S3 bucket name ("BucketName") to use in an IAM policy that gives ...
Kate Wang's user avatar
2 votes
1 answer
2k views

CloudFormation nested stack parameters

I'm trying to reuse old VPC and ELB templates in a Nested CloudFormation stack. VPC template: { "AWSTemplateFormatVersion" : "2010-09-09", "Description" : "AppVPC", "Resources" : { "...
Libert's user avatar
  • 172
2 votes
1 answer
9k views

Cloudformation in create stack error: "ELB cannot be attached to multiple subnets in the same AZ"

I trying to build infrastracture with Cloudformation json template. When I added two Subnets and SubnetRouteTableAssociation in both availability zones that i need. But creating process failing to ...
muzafarow's user avatar
  • 926
2 votes
1 answer
3k views

Adding a list to the parameters file for Cloudformation template

I have a cloudformation template in which I send a JSON parameters file over. It was not a real problem, as my parameters file used to look like this: [ "InstanceType=t2.medium", "AmiStack=...
niketp's user avatar
  • 419
2 votes
2 answers
4k views

Allow every instance in the same Security Group to share any data between each other at Cloud Formation JSON?

I'm building a Cloud Formation JSON to define EC2 Instances and Security Groups. I need to create a security Group that allows every instance that belongs in it to share any data between each other. ...
lrepolho's user avatar
  • 971
2 votes
2 answers
1k views

CloudFormation AWS::EC2::Instance specify number of instances

Is there a way in the json template under AWS::EC2::Instance to specify the number of instances?
Badmiral's user avatar
  • 1,579
2 votes
3 answers
4k views

Cloudformation template to create EMR cluster

I am trying to create EMR-5.30.1 clusters with applications such as Hadoop, livy, Spark, ZooKeeper, and Hive with the help of the CloudFormation template. But the issue is with this template is I am ...
Albus's user avatar
  • 161
2 votes
3 answers
4k views

Unable to add Fine grain access for Elasticsearch service for Cloudformation

I am creating CloudFormation stack with Elasticsearch service, however it fails for AdvancedSecurityOptions, which works perfectly fine with aws es create-elasticsearch-domain my JSON template snippet ...
Shubham Namdeo's user avatar
2 votes
1 answer
2k views

How to create an EventPattern that filters multiple sources (within an EventBridge rule)?

I'm currently using an EventRule with an EventPattern allowing more than one source - example CloudFormation fragment: EventRule: Type: AWS::Events::Rule Properties: EventBusName: MyEventBus ...
Steve Chambers's user avatar
2 votes
3 answers
5k views

AWS CloudFormation - using !Ref inside !Sub

I'm writing AWS CloudFormation template (using yaml) which creates AWS Service Catalog Product. I'm getting the template for the product using parameter S3FilePath which has a value like the above ...
Yuval Podoksik's user avatar
2 votes
1 answer
4k views

The notification destination service region is not valid for the bucket location constraint when creating SQS Event on S3 Bucket via Cloudformation

I'm creating a cloudformation template which has to create a private bucket and then add event notification that send a message to a queue every time there's an object created in bucket. When i run ...
BUMA's user avatar
  • 225
2 votes
1 answer
539 views

Need Multiple instances to be launched for different environments using one AWS CloudFormation Template

I'm have a requirement to build 3 different types of environment each having different numbers of instances to be launched using single CF template in JSON. For example: 1st ENV needs 2 instances, 2nd ...
Gopi R's user avatar
  • 21
2 votes
1 answer
1k views

Getting JSON serializable error for datetime

I am trying to fetch the CloudFormation stack details using boto3 as below import boto3 import json def lambda_handler(event, context): global cnfOutput cnfOutput = cfn1.describe_stacks(...
RaghuCK's user avatar
  • 125
2 votes
1 answer
770 views

CFT Template error: unresolved condition dependency UseDBSnapshot in Fn::If

Trying to create a CFT for RDS which can handle both the scenarios creating a new RDS Aurora MySQL cluster and create a RDS cluster with a existing DB Cluster Snapshot Here is what I tried, I have ...
Pravin's user avatar
  • 35