Frontend Services
Web interfaces, mobile access, and analytics dashboard
Define Resources: Define your resources in a template, or use a prebuilt template
Upload Template: Upload the template to CloudFormation, or point to a template stored in an Amazon S3 bucket
Create Stack: Run a create stack action - resources are created across multiple services in your AWS account as a running environment
Stack Management: The stack retains control of created resources. You can later update stack, detect drift, or delete stack
CloudFormation offers broad support for AWS services. In cases where exact features aren’t available, you can invoke an AWS Lambda function during stack build that calls the AWS SDK to reach full service API coverage.
Stack as Resource Handle: After successful completion, AWS resources exist in your account and the stack object remains as a handle to all created resources. This enables future actions like updating the stack (creating additional resources or modifying existing ones) or deleting the stack (cleaning up and deleting stack-created resources).
CloudFormation templates can be authored in either JSON or YAML.
AWSTemplateFormatVersion: 2010-09-09Resources:awsexamplebucket1: Type: AWS::S3::Bucket
YAML Advantages:
{"AWSTemplateFormatVersion": "2010-09-09","Resources" : { "awsexamplebucket1" : { "Type" : "AWS::S3::Bucket" }}}
JSON Advantages:
Choose the language that best suits your use case, business needs, and experience. Treat templates as source code and store them in a code repository.
---AWSTemplateFormatVersion: "version date"Description: StringMetadata: template metadataParameters: set of parametersRules: set of rulesMappings: set of mappingsConditions: set of conditionsTransform: set of transformsResources: set of resourcesOutputs: set of outputs
{"Resources": { "Ec2Instance": { "Type": "AWS::EC2::Instance", "Properties": { "ImageId": "ami-9d23aeea", "InstanceType": "m3.medium", "KeyName": {"Ref": "KeyPair"} } }},"Outputs": { "InstanceId": { "Description": "InstanceId", "Value": {"Ref": "Ec2Instance"} }}}
Resources define what needs to be created in the AWS account (all you need). Outputs specify values returned after the stack is created.
Designer is a graphic tool for creating, viewing, and modifying CloudFormation templates with a drag-and-drop interface.
You can use the same CloudFormation template to create both production and development environments while maintaining consistency.
Example Use Case:
These deployment-specific differences can be accomplished using conditions. Conditions help ensure that development, test, and production environments - though different in size and scope - are otherwise configured identically.
Change sets allow you to preview changes before implementing them.
Create Change Set: Submit changes for the stack you want to update
View Change Set: See which stack settings and resources will change
Execute Change Set: CloudFormation updates your stack with those changes
DeletionPolicy Attribute: Use to preserve or back up a resource when its stack is deleted or updated. If a resource has no DeletionPolicy attribute, CloudFormation deletes the resource.
Drift detection identifies when deployed resources no longer match their template specifications.
Application environment created by CloudFormation stack
Someone manually modifies security group outside CloudFormation context (opens new inbound TCP port)
Drift detection run on stack
All resources except security group show IN_SYNC, security group shows MODIFIED with details
Important Consideration: When deleting a stack with drift, the drift is not handled by CloudFormation resource cleanup process. Unresolved resource dependencies might cause delete stack action to fail, requiring manual resolution.
Frontend Services
Web interfaces, mobile access, and analytics dashboard
Backend Services
Search, payments, reviews, and recommendations
Shared Services
CRM databases, common monitoring, alarms, subnets, and security groups
Network
VPCs, internet gateways, VPNs, and NAT devices
Security
IAM policies, users, groups, and roles
Strategy Recommendations:
CloudFormation enables infrastructure as code through templates that can be version-controlled, reused across environments, and managed through automated change processes. This approach transforms infrastructure management from manual, error-prone processes to predictable, repeatable automation.