Main goal:
Source → Build → Test → Staging → Production
Each stage = logical unit validating code as it progresses
Configuration as Code vs Infrastructure as Code:
| Type | Service | Purpose |
|---|---|---|
| IaC | CloudFormation, CDK | Provision infrastructure |
| Configuration | OpsWorks (Chef/Puppet) | Configure applications |
Key: Automate process và lifecycle management. Every step programmed và managed as source code.
| Service | Purpose |
|---|---|
| CodePipeline | Orchestrate workflows |
| CodeCommit | Source control |
| CodeBuild | Build và test |
| CodeDeploy | Deploy applications |
| CodeArtifact | Artifact repository |
| ECR | Container registry |
| SAM | Serverless deployment |
| CDK | Infrastructure as code |
| Amplify | Frontend deployment |
| Copilot | Container deployment |
| X-Ray | Tracing |
| CloudShell | CLI environment |
Deployment types:
Predefined configurations:
CodeDeployDefault.OneAtATimeCodeDeployDefault.HalfAtATimeCodeDeployDefault.AllAtOnceDeployment type: Blue/Green only
Traffic shifting:
Configurations:
CodeDeployDefault.ECSLinear10PercentEvery1MinutesCodeDeployDefault.ECSLinear10PercentEvery3MinutesCodeDeployDefault.ECSCanary10Percent5MinutesCodeDeployDefault.ECSCanary10Percent15MinutesCodeDeployDefault.ECSAllAtOnceDeployment type: Traffic shifting only
Configurations:
CodeDeployDefault.LambdaLinear10PercentEvery1MinuteCodeDeployDefault.LambdaLinear10PercentEvery2MinutesCodeDeployDefault.LambdaLinear10PercentEvery3MinutesCodeDeployDefault.LambdaLinear10PercentEvery10MinutesCodeDeployDefault.LambdaCanary10Percent5MinutesCodeDeployDefault.LambdaCanary10Percent10MinutesCodeDeployDefault.LambdaCanary10Percent15MinutesCodeDeployDefault.LambdaCanary10Percent30MinutesCodeDeployDefault.LambdaAllAtOnceScenario thi: Organization có several AWS accounts (staging, testing, production). Manage updates to CloudFormation template across all accounts với least effort.
Answer: CloudFormation Stack Sets
Stack Sets allow:
# Create stack set
aws cloudformation create-stack-set \
--stack-set-name my-app \
--template-body file://template.yaml
# Deploy to multiple accounts
aws cloudformation create-stack-instances \
--stack-set-name my-app \
--accounts 111111111111 222222222222 \
--regions us-east-1 eu-west-1
Scenario thi: Set up serverless architecture (Lambda, API Gateway, DynamoDB) trong single stack. Locally build, test, debug, deploy.
Options: Elastic Beanstalk, CloudFormation, SAM
Answer: SAM
Why:
# Local testing
sam local invoke
sam local start-api
# Build
sam build
# Deploy
sam deploy --guided
After initial deployment, add more stages:
Scenario thi: Reuse same Lambda function for multiple stages. Function reads from different DynamoDB table depending on stage.
Solution: Stage variables + mapping templates
{
"TableName": "$stageVariables.tableName"
}
Lambda receives:
table_name = event['stageVariables']['tableName']
Configure per stage:
tableName = orders-devtableName = orders-prod| Capability | Purpose |
|---|---|
| Parameter Store | Parameter labels, versions |
| Application Manager | Troubleshoot applications |
| AppConfig | Create, manage, deploy configurations |
# Create parameter with label
aws ssm put-parameter \
--name /myapp/config \
--value "v1-config" \
--type String
# Add label
aws ssm label-parameter-version \
--name /myapp/config \
--parameter-version 1 \
--labels prod
# Get by label
aws ssm get-parameter \
--name /myapp/config:prod
Why tag images:
Examples:
myapp:dev-latestmyapp:prod-v1.2.3myapp:feature-authGit-based workflow với continuous deployment:
Keywords: Serverless backends, GraphQL/REST APIs, authentication, analytics, storage
Deploy containerized applications on ECS:
Scenario thi: Deploy Lambda APIs across different AWS accounts và environments.
Architecture:
Dev Account (CodePipeline)
↓ Assume Role
Pre-Prod Account (Deploy)
↓ Assume Role
Prod Account (Deploy)
CodePipeline stages:
IAM Roles needed:
Create test events trong Lambda console:
Essential for scale:
Tools:
| Service | Rotates |
|---|---|
| AWS Certificate Manager | ✅ Certificates |
| Secrets Manager | ✅ Credentials |
| KMS | ✅ Keys |
| Parameter Store | ❌ Manual |
| IAM Database Authentication | ❌ Manual |
Exam tip: Certificate Manager và Secrets Manager automate rotation. Parameter Store does NOT.
CI/CD best practices từ Well-Architected Framework:
Exam Tips: