Lab setup data from the Pluralsight course on:
Create and Manage Stacks with AWS CloudFormation Using the Command Line Interface
The Complete Obsolete Guide to Generative AI (from Manning) is a lighthearted look at programming with AI, as well as a rock-solid resource for getting the most out of these insanely powerful services. Let it be your guide to analyzing massive data sources, summarize pages and pages of text, and scour the live internet.
Validating a template
aws cloudformation validate-template \ --template-body file://ec2-template.json
Estimating a stack costs
aws cloudformation estimate-template-cost \ --template-body file://ec2-template.json \ --parameters ParameterKey=KeyName,ParameterValue=newcluster \ ParameterKey=InstanceType,ParameterValue=t2.micro
Creating a new stack
aws cloudformation create-stack \ --template-body file://ec2-template.json \ --stack-name my-instance \ --parameters ParameterKey=KeyName,ParameterValue=newcluster \ ParameterKey=InstanceType,ParameterValue=t2.micro
Display stack life cycle events
aws cloudformation describe-stack-events \ --stack-name my-instance
Create stack with parameters
aws cloudformation create-stack \ --template-body file://lamp-as.json \ --stack-name lamp-as \ --parameters \ ParameterKey=KeyName,ParameterValue=newcluster \ ParameterKey=VpcId,ParameterValue=vpc-1ffbc964 \ ParameterKey=Subnets,ParameterValue=\'subnet-0e170b31,subnet-52d6117c\' \ ParameterKey=DBUser,ParameterValue=myadmin \ ParameterKey=DBPassword,ParameterValue=mypass23
Describe EC2 instances
aws ec2 describe-instances \ --filters Name=instance-state-name,Values=running \ --query 'Reservations[*].Instances[*].{Instance:InstanceId,PublicIPAddress:PublicIpAddress}'
A rollback configuration
--rollback-configuration { "RollbackTriggers": [ { "Arn": "$ALARM_ARN", "Type": "AWS::CloudWatch::Alarm" } ], "MonitoringTimeInMinutes": 2 }
Update a stack
aws cloudformation update-stack \ --stack-name newstack \ --template-body file://ec2-template-update1.json \ --parameters ParameterKey=KeyName,ParameterValue=newcluster
Change set commands
aws cloudformation create-change-set \ --stack-name my-stack \ --change-set-name my-change-set-4 \ --template-body file://template-update3.yaml \ --capabilities CAPABILITY_IAM aws cloudformation list-change-sets \ --stack-name my-stack aws cloudformation describe-change-set \ --change-set-name my-change-set-4 aws cloudformation execute-change-set --change-set-name my-change-set-4 --stack-name my-stack
Reference a transform
{ "Transform" : { "Name" : "AWS::Include", "Parameters" : { "Location" : "s3://MyAmazonS3BucketName/MyFileName.json" } } }