EBS volumes are AZ-specific. For cross-AZ failover: create a snapshot and restore a new volume in the target AZ:
aws ec2 create-snapshot --volume-id vol-xxx
For shared access on Nitro instances, EBS Multi-Attach can be used.
For failover resilience of stateful data, use ASG patterns with EFS or replicate via snapshots.
3
Explain how Security Groups act as a virtual firewall in a VPC with multiple tiers (web, app, DB). Give a real config example.
Security Groups (SGs) are stateful: return traffic is allowed automatically.
3-tier example:
Web SG: allow inbound 80/443 from 0.0.0.0/0; outbound to App SG on 8080.
App SG: inbound from Web SG only; outbound to DB SG on 3306.
DB SG: inbound from App SG only.
CLI example to allow web ingress:
aws ec2 authorize-security-group-ingress --group-id sg-web --protocol tcp --port 80 --cidr 0.0.0.0/0
Best practice: least privilege and reference SGs (not CIDRs) for autoscaling environments.
4
Your S3 bucket is public by mistake in prod. How do you secure it immediately, and prevent recurrence?
Apply a restrictive bucket policy (deny public actions), e.g.:
{"Statement":[{"Effect":"Deny","Principal":"","Action":"s3:","Resource":"arn:aws:s3:::mybucket/*","Condition":{"StringNotEquals":{"aws:PrincipalAccount":"123456789012"}}}]}
Use SCPs, IAM Access Analyzer, and automated audits to prevent recurrence.
5
Walk through creating a simple CloudFormation stack for an EC2 instance with EBS. What's a common deployment pitfall?
Best practices: enable versioning, use MFA Delete for critical buckets, and use S3 Inventory for audits. Configure lifecycle transitions/expirations carefully (e.g., transition to IA after 30 days).
11
Lambda cold starts are killing your API perf (500ms+). Mitigation for a Node.js function behind API Gateway?
#!/bin/bash
yum update -y
if ! rpm -q nginx; then yum install -y nginx; fi
Use cfn-init and cfn-signal to report success/failure and use WaitCondition for ordering.
Wrap provisioning commands to handle retries and partial failures.
13
Multi-AZ ALB with ASG: targets in private subnets unhealthy. Cross-zone load balancing off? Explain impact.
If cross-zone load balancing is disabled, ALB sends traffic only to targets in the same AZ as the incoming request. Under AZ skew or instance drain, traffic can be uneven and cause apparent unavailability.