Your first deploy¶
This page deploys a small stack, changes it, and removes it.
You need cfnrain (Install) and AWS credentials that can create CloudFormation stacks and S3 buckets. Run cfnrain info to see the account and region that cfnrain uses.
Deploy¶
Save this template as bucket.yaml:
Parameters:
Env:
Type: String
Description: The environment name
AllowedValues: [dev, prod]
Resources:
Bucket:
Type: AWS::S3::Bucket
Properties:
Tags:
- Key: Env
Value: !Ref Env
Outputs:
BucketName:
Value: !Ref Bucket
Deploy it:
The first time, cfnrain asks to create its artifact bucket. Answer yes.
cfnrain asks for the value of the Env parameter:
Enter dev. cfnrain then shows what CloudFormation will change, and asks you to confirm:
CloudFormation will make the following changes:
Stack bucket:
+ AWS::S3::Bucket Bucket
Do you wish to continue? (Y/n)
Answer yes. cfnrain shows the progress, then prints the outputs. The stack name is bucket, the template file name without its extension.
Change the stack¶
Add a second tag to the bucket in bucket.yaml, and run the same command again:
cfnrain asks for Env again and shows the existing value. Press Enter to keep it. The change set shows > for the modified bucket.
Deploy without questions¶
Give the parameter on the command line and add -y. cfnrain then asks nothing:
This is how you deploy from scripts and CI. See CI usage.
Remove the stack¶
cfnrain shows the stack and asks you to confirm. Add -y to skip the question.
Next steps¶
- Deploying explains the deploy flow, parameter sources and change sets.
- Template directives and modules add features to your templates.
- The
deploypage lists every flag.