Provides comprehensive guidance for AWS CloudFormation including templates, stacks, parameters, and infrastructure automation. Use when the user asks about CloudFormation, needs to create AWS infrastructure as code, manage stacks, or implement AWS IaC best practices.
Use this skill whenever the user wants to:
AWSTemplateFormatVersion: '2010-09-09'
Description: Simple S3 bucket with versioning
Parameters:
Environment:
Type: String
AllowedValues: [dev, staging, prod]
Default: dev
Resources:
AppBucket:
Type: AWS::S3::Bucket
Properties:
BucketName: !Sub 'myapp-${Environment}-assets'
VersioningConfiguration:
Status: Enabled
Outputs:
BucketArn:
Value: !GetAtt AppBucket.Arn
Export:
Name: !Sub '${Environment}-AppBucketArn'
# Validate template
aws cloudformation validate-template --template-body file://template.yaml
# Create stack with change set preview
aws cloudformation deploy \
--template-file template.yaml \
--stack-name myapp-dev \
--parameter-overrides Environment=dev
# In consuming stack — import the exported bucket ARN
Resources:
LambdaFunction:
Type: AWS::Lambda::Function
Properties:
Environment:
Variables:
BUCKET_ARN: !ImportValue dev-AppBucketArn
Parameter + NoEcho or AWS Secrets Manager — never hardcodedev-, prod-) to avoid conflictsDependsOn or split resources across stacksaws cloudformation detect-stack-drift to find out-of-band changescloudformation, aws, infrastructure as code, cloudformation template, aws iac, nested stacks, cross-stack references