Cloud and deployment · Advanced · 32 min
Run a blue-green deployment on AWS with an Application Load Balancer
By Padding · Updated 18 Nov 2026
Ubuntu 26.04 · AWS CLI 2.42.4
You will put two versions of a small site behind one HTTPS Application Load Balancer, test the new one with a header before anyone sees it, move traffic across with weights from 90/10 to 0/100, roll back in one command and retire the old version without cutting off requests in flight.
On this page
A blue-green release keeps two copies of your app running side by side. Blue is the version users have now. Green is the new one. Both sit behind the same Application Load Balancer, so moving users between them is a change to the load balancer's listener, not a DNS change, and it takes effect in seconds. If green misbehaves, you move them back the same way, because blue is still running.
In this tutorial you build that set-up for a tiny site called shop-demo. You request an HTTPS certificate, launch blue on one EC2 instance and put it behind a load balancer with an HTTPS listener. Then you launch green, check it through a test header that only you send, and shift real traffic with a weighted forward action: 10 per cent to green first, then all of it. You practise a rollback, and finally retire blue with a deregistration delay so requests already in progress finish cleanly.
This bills while it runs. An Application Load Balancer costs 0.0225 USD per hour plus 0.008 USD per load balancer capacity unit (LCU) hour in US East (N. Virginia), and a partial hour counts as a full one (AWS's Elastic Load Balancing pricing page, checked 26 November 2026). Left running for a month, the hourly part alone is about 16 USD. The two t3.micro instances and the public IPv4 addresses on them and on the load balancer also bill by the hour, at your Region's rates. Prices differ by Region, including Cape Town (af-south-1), so check yours. The last step deletes everything; plan to finish in one sitting.
Step 1 · Point the CLI at your account and prepare the network
If you use a named profile, run export AWS_PROFILE=<your-sandbox-profile> first (replace the placeholder). Check who you are and which Region you are in, since every resource here belongs to one Region:
aws --version
aws sts get-caller-identity --query Arn --output text
aws ec2 describe-availability-zones --query 'AvailabilityZones[0].RegionName' --output textMake a working folder and set the two names this tutorial uses. Replace example.com with your hosted zone and shop.example.com with a new name inside it that nothing uses yet:
mkdir -p ~/bluegreen-demo
cd ~/bluegreen-demo
ZONE_NAME=example.com # replace: your Route 53 hosted zone
DOMAIN=shop.example.com # replace: an unused name inside that zone
ZONE_ID=$(aws route53 list-hosted-zones-by-name --dns-name "$ZONE_NAME" \
--query "HostedZones[?Name=='${ZONE_NAME}.'].Id | [0]" --output text)
echo "zone: $ZONE_ID"The query matches the zone name exactly. list-hosted-zones-by-name on its own returns zones in alphabetical order starting from the name you give, so without the filter it can hand back a different zone when yours does not exist.
The load balancer and the instances go in the default VPC. An internet-facing load balancer needs subnets in at least two Availability Zones, and the default VPC has one default subnet per zone, so take two:
VPC_ID=$(aws ec2 describe-vpcs --filters Name=is-default,Values=true \
--query 'Vpcs[0].VpcId' --output text)
SUBNET_A=$(aws ec2 describe-subnets \
--filters Name=vpc-id,Values="$VPC_ID" Name=default-for-az,Values=true \
--query 'Subnets[0].SubnetId' --output text)
SUBNET_B=$(aws ec2 describe-subnets \
--filters Name=vpc-id,Values="$VPC_ID" Name=default-for-az,Values=true \
--query 'Subnets[1].SubnetId' --output text)
echo "vpc: $VPC_ID subnets: $SUBNET_A $SUBNET_B"Now two security groups. The load balancer's accepts HTTPS from anyone. The instances' accepts port 80 only from the load balancer's group, so nobody can reach blue or green directly and skip the listener:
ALB_SG=$(aws ec2 create-security-group --vpc-id "$VPC_ID" \
--group-name shop-demo-alb --description "shop-demo load balancer: HTTPS from anyone" \
--query GroupId --output text)
aws ec2 authorize-security-group-ingress --group-id "$ALB_SG" \
--protocol tcp --port 443 --cidr 0.0.0.0/0 > /dev/null
APP_SG=$(aws ec2 create-security-group --vpc-id "$VPC_ID" \
--group-name shop-demo-app --description "shop-demo instances: port 80 from the load balancer" \
--query GroupId --output text)
aws ec2 authorize-security-group-ingress --group-id "$APP_SG" \
--protocol tcp --port 80 --source-group "$ALB_SG" > /dev/null
cat > ids.env <<EOF
ZONE_NAME=$ZONE_NAME
DOMAIN=$DOMAIN
ZONE_ID=$ZONE_ID
VPC_ID=$VPC_ID
SUBNET_A=$SUBNET_A
SUBNET_B=$SUBNET_B
ALB_SG=$ALB_SG
APP_SG=$APP_SG
EOF
echo "alb sg: $ALB_SG app sg: $APP_SG"ids.env keeps every ID this tutorial creates. Each step adds to it. If you open a new terminal, cd ~/bluegreen-demo && source ids.env brings the variables back.
Check it worked
aws --version starts with aws-cli/2.42, the ARN belongs to your sandbox account, the next line names the Region you meant to use (for example eu-west-2; an error saying you must specify a Region means none is set, so run export AWS_REGION=<your-region>), the zone line shows an ID starting /hostedzone/ (not None), and you see one vpc- ID, two subnet- IDs and two sg- IDs.
Step 2 · Request an HTTPS certificate with DNS validation
AWS Certificate Manager (ACM) issues the certificate the listener presents. Public ACM certificates used on a load balancer have no charge of their own, and ACM renews them for you as long as the validation record stays in DNS.
CERT_ARN=$(aws acm request-certificate --domain-name "$DOMAIN" \
--validation-method DNS --query CertificateArn --output text)
echo "CERT_ARN=$CERT_ARN" >> ids.env
echo "$CERT_ARN"ACM proves you control the name by asking for a CNAME record. The record details appear a few seconds after the request, so poll for them:
VALIDATION=None
for i in $(seq 1 12); do
VALIDATION=$(aws acm describe-certificate --certificate-arn "$CERT_ARN" \
--query 'Certificate.DomainValidationOptions[0].ResourceRecord.[Name,Value]' --output text)
if [ "$VALIDATION" != "None" ]; then break; fi
sleep 5
done
read -r VAL_NAME VAL_VALUE <<< "$VALIDATION"
echo "name: $VAL_NAME value: $VAL_VALUE"Write the record as a change batch file, apply it, and wait for Route 53 to report it in sync. You keep the file: the clean-up step reuses it to delete the record.
cat > validation.json <<EOF
{
"Comment": "ACM validation for $DOMAIN",
"Changes": [{
"Action": "UPSERT",
"ResourceRecordSet": {
"Name": "$VAL_NAME",
"Type": "CNAME",
"TTL": 300,
"ResourceRecords": [{ "Value": "$VAL_VALUE" }]
}
}]
}
EOF
CHANGE_ID=$(aws route53 change-resource-record-sets --hosted-zone-id "$ZONE_ID" \
--change-batch file://validation.json --query ChangeInfo.Id --output text)
aws route53 wait resource-record-sets-changed --id "$CHANGE_ID"
aws acm wait certificate-validated --certificate-arn "$CERT_ARN"The last command checks every minute and gives up after 40 tries. Validation usually finishes within a few minutes of the record going live. If the waiter times out, check that the record name in validation.json sits in the zone you changed.
Check it worked
aws acm describe-certificate --certificate-arn "$CERT_ARN" \
--query 'Certificate.[DomainName, Status]' --output textYou see your domain and ISSUED.
Step 3 · Launch blue and give it a target group
Each version gets its own instance and its own target group, the list of targets the load balancer forwards to and health-checks. Blue serves a page that says which version it is, and a /health page for the load balancer's checks. The script runs once, at first boot:
cat > blue.sh <<'EOF'
#!/bin/bash
dnf install -y nginx
echo "shop-demo blue v1" > /usr/share/nginx/html/index.html
echo "ok" > /usr/share/nginx/html/health
systemctl enable --now nginx
EOF
AMI_ID=$(aws ssm get-parameter \
--name /aws/service/ami-amazon-linux-latest/al2023-ami-kernel-default-x86_64 \
--query Parameter.Value --output text)
BLUE_ID=$(aws ec2 run-instances --image-id "$AMI_ID" --instance-type t3.micro \
--subnet-id "$SUBNET_A" --security-group-ids "$APP_SG" \
--user-data file://blue.sh \
--tag-specifications 'ResourceType=instance,Tags=[{Key=Name,Value=shop-demo-blue}]' \
--query 'Instances[0].InstanceId' --output text)
echo "BLUE_ID=$BLUE_ID" >> ids.env
aws ec2 wait instance-running --instance-ids "$BLUE_ID"
echo "blue: $BLUE_ID on $AMI_ID"The AMI ID comes from a public SSM parameter that AWS keeps pointed at the latest Amazon Linux 2023 image, so the command works in any Region. The CLI base64-encodes the user data file for you. There is no key pair: nothing in this tutorial needs SSH, and an instance you cannot log in to is one less thing to secure.
Create the target group, then register blue in it:
BLUE_TG=$(aws elbv2 create-target-group --name shop-demo-blue \
--protocol HTTP --port 80 --vpc-id "$VPC_ID" --target-type instance \
--health-check-path /health --health-check-interval-seconds 10 \
--healthy-threshold-count 2 --unhealthy-threshold-count 3 --matcher HttpCode=200 \
--query 'TargetGroups[0].TargetGroupArn' --output text)
echo "BLUE_TG=$BLUE_TG" >> ids.env
aws elbv2 register-targets --target-group-arn "$BLUE_TG" --targets Id="$BLUE_ID"One more setting matters later. When you remove a target from a group, the load balancer stops sending it new requests but lets the ones already in progress finish. That waiting period is the deregistration delay, and the default is 300 seconds. For a site whose requests take a second or two, 30 seconds is plenty, and it makes retiring a version much quicker:
aws elbv2 modify-target-group-attributes --target-group-arn "$BLUE_TG" \
--attributes Key=deregistration_delay.timeout_seconds,Value=30 \
--query "Attributes[?Key=='deregistration_delay.timeout_seconds'].Value" --output textSet it longer than your slowest normal request. A file upload over a slow mobile connection can take minutes, and a delay that is too short cuts it off halfway.
Check it worked
The last command printed 30. List the group's targets:
aws elbv2 describe-target-health --target-group-arn "$BLUE_TG" \
--query 'TargetHealthDescriptions[].[Target.Id, TargetHealth.State]' --output textYou see blue's instance ID followed by unused. That is expected: a target group only runs health checks once a load balancer forwards to it, which happens in the next step.
Step 4 · Put blue behind an HTTPS load balancer
Create the load balancer in the two subnets, with its own security group:
ALB_ARN=$(aws elbv2 create-load-balancer --name shop-demo \
--type application --scheme internet-facing \
--subnets "$SUBNET_A" "$SUBNET_B" --security-groups "$ALB_SG" \
--query 'LoadBalancers[0].LoadBalancerArn' --output text)
echo "ALB_ARN=$ALB_ARN" >> ids.env
aws elbv2 wait load-balancer-available --load-balancer-arns "$ALB_ARN"Each subnet ID sits in its own quoted variable, so the command behaves the same in bash and in zsh, the default shell on macOS.
Now the listener. Its default action is already written as a weighted forward with blue at 100, even though there is only one group. Every later change then edits the weights in the same shape, which keeps the commands for a shift and a rollback identical. The security policy is the one AWS recommends; the CLI's own default is an older policy that still allows TLS 1.0, so always name one:
LISTENER_ARN=$(aws elbv2 create-listener --load-balancer-arn "$ALB_ARN" \
--protocol HTTPS --port 443 \
--ssl-policy ELBSecurityPolicy-TLS13-1-2-Res-PQ-2025-09 \
--certificates CertificateArn="$CERT_ARN" \
--default-actions "[{\"Type\":\"forward\",\"ForwardConfig\":{\"TargetGroups\":[{\"TargetGroupArn\":\"$BLUE_TG\",\"Weight\":100}]}}]" \
--query 'Listeners[0].ListenerArn' --output text)
echo "LISTENER_ARN=$LISTENER_ARN" >> ids.envPoint your name at the load balancer with an alias record. An alias needs the load balancer's DNS name and the hosted zone ID AWS uses for load balancers in your Region, and describe-load-balancers gives you both:
read -r ALB_DNS ALB_ZONE <<< "$(aws elbv2 describe-load-balancers --load-balancer-arns "$ALB_ARN" \
--query 'LoadBalancers[0].[DNSName, CanonicalHostedZoneId]' --output text)"
cat > alias.json <<EOF
{
"Comment": "$DOMAIN to the shop-demo load balancer",
"Changes": [{
"Action": "UPSERT",
"ResourceRecordSet": {
"Name": "$DOMAIN",
"Type": "A",
"AliasTarget": {
"HostedZoneId": "$ALB_ZONE",
"DNSName": "$ALB_DNS",
"EvaluateTargetHealth": false
}
}
}]
}
EOF
CHANGE_ID=$(aws route53 change-resource-record-sets --hosted-zone-id "$ZONE_ID" \
--change-batch file://alias.json --query ChangeInfo.Id --output text)
aws route53 wait resource-record-sets-changed --id "$CHANGE_ID"
echo "$DOMAIN -> $ALB_DNS"This is the only DNS change in the whole release. From here on, blue and green swap behind the same name, so nobody waits for a DNS cache to expire, including mobile networks and resolvers that keep old answers longer than the TTL says.
Check it worked
Now that the listener forwards to blue, the health checks start. Wait for them to pass; a new instance needs a minute or two to boot and install nginx:
aws elbv2 wait target-in-service --target-group-arn "$BLUE_TG" --targets Id="$BLUE_ID"
aws elbv2 describe-target-health --target-group-arn "$BLUE_TG" \
--query 'TargetHealthDescriptions[].[Target.Id, TargetHealth.State]' --output textYou see blue's instance ID and healthy. If the waiter gives up, run the second command again: the state column says why, for example unhealthy when /health does not return 200.
Fetch the page over HTTPS a few times:
for i in 1 2 3; do curl -s "https://$DOMAIN/"; doneEvery line reads shop-demo blue v1, and curl did not complain about the certificate. The listener's weights confirm what you see:
aws elbv2 describe-listeners --listener-arns "$LISTENER_ARN" \
--query 'Listeners[0].[Protocol, Port, DefaultActions[0].ForwardConfig.TargetGroups[0].Weight]' --output textThat prints HTTPS 443 100.
Step 5 · Bring green up and test it with a private header
Green is the release you want to ship. In a real project this is your new build; here it is the same page with a different label:
sed 's/blue v1/green v2/' blue.sh > green.sh
GREEN_ID=$(aws ec2 run-instances --image-id "$AMI_ID" --instance-type t3.micro \
--subnet-id "$SUBNET_B" --security-group-ids "$APP_SG" \
--user-data file://green.sh \
--tag-specifications 'ResourceType=instance,Tags=[{Key=Name,Value=shop-demo-green}]' \
--query 'Instances[0].InstanceId' --output text)
echo "GREEN_ID=$GREEN_ID" >> ids.env
aws ec2 wait instance-running --instance-ids "$GREEN_ID"
GREEN_TG=$(aws elbv2 create-target-group --name shop-demo-green \
--protocol HTTP --port 80 --vpc-id "$VPC_ID" --target-type instance \
--health-check-path /health --health-check-interval-seconds 10 \
--healthy-threshold-count 2 --unhealthy-threshold-count 3 --matcher HttpCode=200 \
--query 'TargetGroups[0].TargetGroupArn' --output text)
echo "GREEN_TG=$GREEN_TG" >> ids.env
aws elbv2 modify-target-group-attributes --target-group-arn "$GREEN_TG" \
--attributes Key=deregistration_delay.timeout_seconds,Value=30 > /dev/null
aws elbv2 register-targets --target-group-arn "$GREEN_TG" --targets Id="$GREEN_ID"Green lands in the second subnet, so the two versions also sit in different Availability Zones. Green gets the same 30-second deregistration delay, because one day green will be the version you retire.
Healthy will only mean /health answers 200. Before real users see green, look at it yourself. A listener rule sends requests that carry a header of your choosing to green, while everyone else keeps getting the default action, blue:
PREVIEW_RULE=$(aws elbv2 create-rule --listener-arn "$LISTENER_ARN" --priority 10 \
--conditions '[{"Field":"http-header","HttpHeaderConfig":{"HttpHeaderName":"X-Release-Channel","Values":["green"]}}]' \
--actions "[{\"Type\":\"forward\",\"TargetGroupArn\":\"$GREEN_TG\"}]" \
--query 'Rules[0].RuleArn' --output text)
echo "PREVIEW_RULE=$PREVIEW_RULE" >> ids.env
aws elbv2 wait target-in-service --target-group-arn "$GREEN_TG" --targets Id="$GREEN_ID"The rule is also what starts green's health checks, because it is the first thing that forwards to green's group, so the waiter comes after it.
The header is not a secret, so do not use this to hide unreleased features: anyone who guesses it sees green. It is a way to test the real path, through the real certificate and load balancer, before you shift traffic.
Check it worked
curl -s -H "X-Release-Channel: green" "https://$DOMAIN/"
curl -s "https://$DOMAIN/"The first line reads shop-demo green v2 and the second shop-demo blue v1. Green's target health shows its instance as healthy:
aws elbv2 describe-target-health --target-group-arn "$GREEN_TG" \
--query 'TargetHealthDescriptions[].[Target.Id, TargetHealth.State]' --output textStep 6 · Send 10 per cent of traffic to green
A shift is one modify-listener call with new weights. Put it in a small script so a shift and a rollback are the same command with different numbers, which matters when you are rolling back under pressure:
cat > shift-traffic.sh <<'EOF'
# Usage: shift_traffic <blue-weight> <green-weight> (each 0 to 999)
shift_traffic() {
aws elbv2 modify-listener --listener-arn "$LISTENER_ARN" \
--default-actions "[{\"Type\":\"forward\",\"ForwardConfig\":{\"TargetGroups\":[{\"TargetGroupArn\":\"$BLUE_TG\",\"Weight\":$1},{\"TargetGroupArn\":\"$GREEN_TG\",\"Weight\":$2}],\"TargetGroupStickinessConfig\":{\"Enabled\":false}}}]" \
--query 'Listeners[0].DefaultActions[0].ForwardConfig.TargetGroups[].Weight' --output text
}
EOF
source shift-traffic.sh
shift_traffic 90 10Weights are relative, so 90 and 10 send nine requests in ten to blue. Stickiness is off, so each request is drawn afresh. That gives you an even 10 per cent sample quickly, but it also means one visitor can load a page from blue and its next request from green. If your two versions are not compatible at that level, for example the page from blue asks for script files with hashed names that only exist on blue, turn stickiness on with "TargetGroupStickinessConfig":{"Enabled":true,"DurationSeconds":3600}. The load balancer then sets an AWSALBTG cookie and keeps each visitor on the version they first got.
Watch green while it takes its share: its 5xx count and response time in the target group's CloudWatch metrics, and your application logs. Keep the 10 per cent long enough to see real traffic; ten minutes on a quiet site tells you very little.
Check it worked
The script printed 90 10. Send 50 requests and count the answers:
for i in $(seq 1 50); do curl -s "https://$DOMAIN/"; done | sort | uniq -cYou see something like 45 shop-demo blue v1 and 5 shop-demo green v2. The split is random per request, so a few either way is normal. Each request opens a fresh TLS connection and downloads the certificate chain, so the loop transfers a few hundred KB in total: fine on prepaid mobile data, but not free.
Step 7 · Move all traffic to green and practise the rollback
When green has held up at 10 per cent, give it everything:
shift_traffic 0 100Blue now gets no new requests, but it keeps running and stays registered and health-checked. That is the point of blue-green: until you retire blue, a rollback is the same one command.
Practise it now, while nothing is wrong, so you know it works and how long it takes:
shift_traffic 100 0Every new request goes to blue again within seconds. Then go forward once more:
shift_traffic 0 100Two things a weighted forward will not do for you. It does not fail over by itself: if green's targets all turn unhealthy while green holds weight, the load balancer keeps sending green its share rather than moving it to blue, so the rollback is your decision, made from your alarms. And it only moves HTTP traffic. If green changed the database, for example by renaming a column, blue may break when you roll back to it. Make schema changes backward compatible (add the new column, deploy code that writes both, remove the old one in a later release) so that both versions can run against the same database at once. /tutorials/understand-blue-green-and-canary-deployments covers this pattern and when a canary release is the better fit.
Check it worked
The three calls printed 0 100, then 100 0, then 0 100. Fetching the page now returns only green:
for i in $(seq 1 20); do curl -s "https://$DOMAIN/"; done | sort | uniq -cYou see 20 shop-demo green v2.
Step 8 · Retire blue without cutting off requests
Decide how long blue stays as your rollback. A few hours covers most problems that show up under real load; a full business day catches the ones that only appear at peak. Then remove the preview rule, which is no longer needed, and deregister blue's instance:
aws elbv2 delete-rule --rule-arn "$PREVIEW_RULE"
aws elbv2 deregister-targets --target-group-arn "$BLUE_TG" --targets Id="$BLUE_ID"
aws elbv2 describe-target-health --target-group-arn "$BLUE_TG" --targets Id="$BLUE_ID" \
--query 'TargetHealthDescriptions[].[Target.Id, TargetHealth.State, TargetHealth.Reason]' --output textFor up to the 30 seconds you set earlier, blue's instance shows something like draining Target.DeregistrationInProgress: it finishes requests it already has and gets no new ones. After that it shows unused Target.NotRegistered. Only then terminate it:
sleep 30
aws ec2 terminate-instances --instance-ids "$BLUE_ID" \
--query 'TerminatingInstances[0].CurrentState.Name' --output text
aws ec2 wait instance-terminated --instance-ids "$BLUE_ID"From this point a rollback means building blue again, so do not retire it early. For the next release, the roles swap: the new build goes into the empty shop-demo-blue group and you shift with shift_traffic 10 90, then shift_traffic 100 0.
Check it worked
The terminate command printed shutting-down, the waiter returned, and blue's target group no longer lists any targets:
aws elbv2 describe-target-health --target-group-arn "$BLUE_TG" \
--query 'length(TargetHealthDescriptions)'That prints 0.
Step 9 · Clean up
The load balancer bills until you delete it. Load the IDs and print them, and check they are the ones this tutorial created (they came from ids.env) before you run any delete. The DNS records go first, reusing the change files with DELETE in place of UPSERT:
cd ~/bluegreen-demo
source ids.env
echo "$DOMAIN $ALB_ARN $BLUE_TG $GREEN_TG $GREEN_ID $CERT_ARN $APP_SG $ALB_SG"When the IDs match, delete the two records:
sed 's/"UPSERT"/"DELETE"/' alias.json > alias-delete.json
sed 's/"UPSERT"/"DELETE"/' validation.json > validation-delete.json
aws route53 change-resource-record-sets --hosted-zone-id "$ZONE_ID" --change-batch file://alias-delete.json > /dev/null
aws route53 change-resource-record-sets --hosted-zone-id "$ZONE_ID" --change-batch file://validation-delete.json > /dev/nullDelete the load balancer (which deletes its listener), then the target groups and green's instance:
aws elbv2 delete-load-balancer --load-balancer-arn "$ALB_ARN"
aws elbv2 wait load-balancers-deleted --load-balancer-arns "$ALB_ARN"
aws elbv2 delete-target-group --target-group-arn "$BLUE_TG"
aws elbv2 delete-target-group --target-group-arn "$GREEN_TG"
aws ec2 terminate-instances --instance-ids "$GREEN_ID" > /dev/null
aws ec2 wait instance-terminated --instance-ids "$GREEN_ID"The certificate and the load balancer's security group stay in use for a short while after the load balancer goes, until AWS releases its network interfaces. The loops below retry every 15 seconds for up to five minutes:
aws ec2 delete-security-group --group-id "$APP_SG"
for i in $(seq 1 20); do
if aws ec2 delete-security-group --group-id "$ALB_SG"; then break; fi
sleep 15
done
for i in $(seq 1 20); do
if aws acm delete-certificate --certificate-arn "$CERT_ARN"; then break; fi
sleep 15
done
cd ~
rm -rf ~/bluegreen-demo
unset ZONE_NAME DOMAIN ZONE_ID VPC_ID SUBNET_A SUBNET_B ALB_SG APP_SG CERT_ARN VALIDATION VAL_NAME VAL_VALUE CHANGE_ID AMI_ID BLUE_ID GREEN_ID BLUE_TG GREEN_TG ALB_ARN LISTENER_ARN ALB_DNS ALB_ZONE PREVIEW_RULECheck it worked
aws elbv2 describe-load-balancers --names shop-demo reports that the load balancer is not found, aws ec2 describe-security-groups --filters Name=group-name,Values=shop-demo-alb,shop-demo-app --query 'SecurityGroups[].GroupId' --output text prints nothing, and ls ~/bluegreen-demo reports that the folder does not exist. Check the next day's bill in Cost Explorer to confirm nothing is still running.
Next steps
- Compare blue-green with canary and rolling releases, and plan database changes that survive a rollback: understand blue-green and canary deployments.
- Run each colour as an Auto Scaling group instead of a single instance, so a version survives losing a server: scale EC2 instances with an Auto Scaling group.
- Get an email when green's error count rises during a shift: create CloudWatch alarms that email you.
- Tighten the two security groups and see how they chain by group ID: control traffic with security groups and network ACLs.
Related tutorials
- Tag cloud resources so you know what costs whatYou will have a four-key tagging scheme applied to every AWS resource through Terraform default_tags, a script that lists resources missing a tag, a tag policy ready for your organisation and cost allocation tags that split the bill by project.
- Store and serve files with Cloudflare R2 from a WorkerYou will build a Worker that uploads, downloads and lists files in an R2 bucket, with a size limit, a content-type allowlist, ETag and range support and a bearer token, test it locally with Wrangler and Vitest, and reach the same bucket through R2's S3-compatible API.
- Store container images in Amazon ECR with scanning and lifecycle policiesYou will have a private Amazon ECR repository with immutable tags and scan on push, an nginx image copied into it with crane, its vulnerability findings read from the CLI, a lifecycle policy that keeps the ten newest tagged images, and pull access granted to a second AWS account.
Need this done for you?
Padding does this work for growing companies, from the first diagnosis to a system that keeps working.
Get new tutorials