aws:aws-cloudformation
Table of Contents
AWS Cloud Formation
Code Examples
Deploy CloudFormation from cli
Parameters, Mappings, and !Refs
Cloud Formation Mappings and Output Section
Set numeric value to string
Force an string value instead of integer (join two strings with nothing, “”):-
!Join ["", ["00", "1002899"]]
Outputs and Exports
You can now create and export values from one stack and make use of them in other stacks without going to the trouble of creating custom CloudFormation resources. The first stack exports values like this:
Outputs: TSSG: Value: !Ref TroubleShootingSG Export: Name: AccountSG
The other stacks then reference them using the new ImportValue function:
EC2Instance: Type: AWS::EC2::Instance Properties: SecurityGroups: - !ImportValue AccountSG
StackSet - CLI
Create StackSet
aws cloudformation create-stack-set \ --stack-set-name <name> \ --description "Description Text" \ --template-body file://template.yaml \ --profile profile1234 \ --capabilities CAPABILITY-WHATEVER \ --parameters file://parameters.json \ --auto-deployment file://auto-deployment.json \ --managed-execution Active=false \ --auto-deployment Enabled=true, RetainStacksOnAccountRemoval=false
autodeployment.json
{ "Enabled": true, "RetainStacksOnAccountRemoval": false }
Deploy Stackset
aws cloudformation create-stack-instances \ --stack-set-name "Name" \ --accounts 123412341234 \ --regions file://regions.json \ --output json \ --profile profile1234
regions.json:-
["eu-west-1", "us-east-1"]
This page has been accessed for:-
Today: 1
Yesterday: 0
Until now: 641
aws/aws-cloudformation.txt · Last modified: by andrew