Home / Topics / AWS for DevOps / Scenario Questions
AWS for DevOps

Scenario Questions

Real-world AWS situations and how to reason through them in an interview


IAM, Organizations and Multi-Account

๐ŸŽฅ Learn this hands-on with DevOps Shack โ†’ YouTube @devopsshack ยท Hindi @shackverse ยท Courses at devopsshack.com

Q1

A developer needs read-only access to one S3 bucket from their laptop. How do you grant it without creating long-lived access keys?

Beginner

Situation read โ†’ Human access to AWS should be federated and short-lived; an IAM user with static keys is the thing auditors flag first.

What I'd do โ†’

  1. Put the person in IAM Identity Center (SSO) and create a permission set with a scoped policy for that bucket
  2. Assign the permission set to the user or group for the target account
  3. Developer runs aws configure sso then aws sso login --profile dev
  4. Verify with aws s3 ls s3://app-reports --profile dev and aws sts get-caller-identity

Why โ†’ SSO credentials expire in hours, access is revoked centrally when the person leaves, and CloudTrail shows the SSO role session name.

Interview tip โ†’ Say "no IAM users for humans" early; it signals you know the modern baseline.

Copy link
Q2

An EC2 application needs to write to DynamoDB. Where do the credentials come from?

Beginner

Situation read โ†’ Never bake keys into the AMI or env vars; the instance should assume a role through its instance profile.

What I'd do โ†’

  1. Create a role trusting ec2.amazonaws.com with a policy limited to dynamodb:PutItem on the table ARN
  2. Create an instance profile and attach it: aws ec2 associate-iam-instance-profile --instance-id i-0abc --iam-instance-profile Name=orders-app
  3. Use the default SDK credential chain in code, with no keys configured
  4. Enforce IMDSv2 so SSRF cannot trivially steal the role credentials

Why โ†’ The SDK fetches rotating credentials from IMDS automatically, so there is nothing to leak or rotate by hand.

Interview tip โ†’ Mention IMDSv2 HttpTokens=required; it shows security awareness beyond "use a role".

Copy link
Q3

Security wants to know who deleted a production S3 bucket yesterday. How do you find out?

Beginner

Situation read โ†’ This is a CloudTrail question; bucket deletion is a management event, recorded by default for 90 days.

What I'd do โ†’

  1. Open CloudTrail Event history and filter on Event name DeleteBucket
  2. Or CLI: aws cloudtrail lookup-events --lookup-attributes AttributeKey=EventName,AttributeValue=DeleteBucket
  3. Read userIdentity, sourceIPAddress and userAgent to identify the principal
  4. For longer history query the trail's S3 logs with Athena

Why โ†’ Event history only covers 90 days of management events in one region view, so an organization trail to S3 is what actually keeps the evidence.

Interview tip โ†’ Distinguish management events from data events (object-level), which are off by default.

Copy link
Q4

You must stop anyone in a member account from disabling CloudTrail, even account admins. What do you use?

Beginner

Situation read โ†’ IAM policies inside the account cannot restrain the account admin, so the control belongs above the account, in Organizations.

What I'd do โ†’

  1. Create an SCP that denies cloudtrail:StopLogging, cloudtrail:DeleteTrail and cloudtrail:UpdateTrail
  2. Attach it to the OU holding workload accounts
  3. Test from a member account admin: the call should fail with an explicit deny from the SCP
  4. Keep break-glass in the management account, which SCPs do not affect

Why โ†’ SCPs set the maximum permissions boundary for every principal in the account except the management account.

Interview tip โ†’ Remember SCPs never grant anything; they only filter.

Copy link
Q5

A cross-account role assumption fails with AccessDenied even though the target role trusts the source account. What do you check?

Intermediate

Situation read โ†’ Both sides must allow it: the target trust policy and an identity policy on the caller granting sts:AssumeRole.

What I'd do โ†’

  1. Check the role's trust policy principal and any Condition such as sts:ExternalId or aws:PrincipalOrgID
  2. Check the caller's identity policy allows sts:AssumeRole on the exact role ARN
  3. Check no SCP or permissions boundary blocks it
  4. Retry: aws sts assume-role --role-arn arn:aws:iam::222222222222:role/deploy --role-session-name test and read the error text

Why โ†’ Cross-account needs an allow on both sides, whereas same-account trust can be satisfied by one.

Interview tip โ†’ Mention that a trust principal of the account root only delegates; the caller still needs its own allow.

Copy link
Q6

Design access for a CI pipeline in GitHub Actions to deploy to AWS without storing AWS keys in GitHub.

Intermediate

Situation read โ†’ OIDC federation lets GitHub present a signed token that AWS exchanges for temporary role credentials.

What I'd do โ†’

  1. Create an IAM OIDC provider for token.actions.githubusercontent.com with audience sts.amazonaws.com
  2. Create a deploy role whose trust policy uses sts:AssumeRoleWithWebIdentity and a condition token.actions.githubusercontent.com:sub equal to repo:acme/shop:ref:refs/heads/main
  3. In the workflow set permissions: id-token: write and use aws-actions/configure-aws-credentials with role-to-assume
  4. Scope the role policy to only the resources it deploys

Why โ†’ No secret exists to steal, tokens last about an hour, and the sub condition ties the role to one repo and branch.

Interview tip โ†’ Call out that a missing sub condition lets any repo on GitHub assume the role.

Copy link
Q7

How would you let developers create IAM roles for their apps without letting them escalate to admin?

Intermediate

Situation read โ†’ This is the classic delegated-administration problem; solve it with permissions boundaries.

What I'd do โ†’

  1. Define a boundary policy that caps what any app role can ever do (for example no IAM, no Organizations)
  2. Give developers iam:CreateRole and iam:AttachRolePolicy only with condition iam:PermissionsBoundary equal to the boundary ARN
  3. Deny iam:DeleteRolePermissionsBoundary
  4. Prefix-scope with a path such as role/app/*

Why โ†’ Effective permissions are the intersection of identity policy and boundary, so any role they create stays inside the cage.

Interview tip โ†’ Name the escalation path you are blocking: create a role with AdministratorAccess and assume it.

Copy link
Q8

Your company has 40 AWS accounts. How do you structure them and why?

Intermediate

Situation read โ†’ One account is a blast-radius and billing boundary; a landing zone separates concerns from day one.

What I'd do โ†’

  1. Use AWS Organizations with OUs: Security (log archive, audit), Infrastructure (network, shared services), Workloads split into prod and non-prod, Sandbox
  2. Deploy with Control Tower or Landing Zone Accelerator for guardrails
  3. Centralize CloudTrail, Config and GuardDuty into the security accounts
  4. Attach SCPs per OU such as region restriction and deny leaving the org

Why โ†’ Separate prod and non-prod accounts give strong IAM and quota isolation that tags and policies in one account cannot.

Interview tip โ†’ Say "account per workload per environment" and be ready to defend the cost of more accounts.

Copy link
Q9

An access key for an IAM user was committed to a public GitHub repo 20 minutes ago. Walk through your response.

Intermediate

Situation read โ†’ Assume it is already scraped; speed matters more than forensics at first, but preserve evidence.

What I'd do โ†’

  1. Deactivate the key immediately: aws iam update-access-key --user-name ci-bot --access-key-id AKIA... --status Inactive
  2. Attach an explicit deny-all policy or use the AWSCompromisedKeyQuarantine policy AWS may have applied
  3. Query CloudTrail for the key id over the exposure window for unusual calls like RunInstances in odd regions
  4. Terminate rogue resources, check for new IAM users, roles and access keys
  5. Create a replacement via a role or OIDC, then delete the old key and purge it from git history

Why โ†’ Deactivate before delete so you can still audit the key and roll back if a legitimate system breaks.

Interview tip โ†’ Mention enabling secret scanning push protection to prevent a repeat.

Copy link
Q10

A Lambda function cannot read an S3 bucket in another account even though the bucket policy allows the role. Why?

Intermediate

Situation read โ†’ Cross-account S3 access requires the identity policy in the caller account and the bucket policy to both allow, and KMS if the objects are encrypted.

What I'd do โ†’

  1. Confirm the Lambda execution role has s3:GetObject on the bucket ARN and object path
  2. Confirm the bucket policy principal is the role ARN, not just the account root
  3. If SSE-KMS, check the key policy and the role's kms:Decrypt on that key
  4. Check the bucket for Block Public Access or a VPC endpoint policy denying the call

Why โ†’ Missing KMS permission produces an AccessDenied that looks identical to a missing S3 permission, which wastes hours.

Interview tip โ†’ Always ask "is the object KMS-encrypted?" first in cross-account S3 problems.

Copy link
Q11

Design break-glass access for production that is audited, time-bound, and not a shared password.

Advanced

Situation read โ†’ Break-glass must exist and be loud; the failure modes are shared credentials and no alarm.

What I'd do โ†’

  1. Create a dedicated BreakGlassAdmin permission set in Identity Center, assigned to a small group, with session duration 1 hour
  2. Require MFA with phishing-resistant keys
  3. EventBridge rule on the AssumeRole or CreateCredential events for that role pages the on-call and posts to the security channel
  4. Keep two root account credentials sealed offline with hardware MFA for the case SSO itself is down
  5. Quarterly drill, then review the CloudTrail trail of every use

Why โ†’ Auditability plus alerting turns emergency access into an accountable action rather than a backdoor.

Interview tip โ†’ Mention you also test it, since untested break-glass fails when needed.

Copy link
Q12

You need to guarantee no resources are ever created outside eu-west-1 and eu-central-1 across the org. What is the design and the pitfalls?

Advanced

Situation read โ†’ Region restriction is an SCP job, but global services make a naive deny break things.

What I'd do โ†’

  1. Write an SCP with Deny and NotAction listing global services (IAM, Organizations, Route 53, CloudFront, Support, STS)
  2. Condition StringNotEquals on aws:RequestedRegion for the two allowed regions
  3. Add exception for control-plane roles such as the Control Tower execution role via ArnNotLike on aws:PrincipalARN
  4. Apply to a test OU first and watch CloudTrail for denied calls

Why โ†’ Using Action: * without carving out global endpoints in us-east-1 breaks IAM, billing and CloudFront calls.

Interview tip โ†’ Mention opt-in regions and that the CloudFront and ACM-for-CloudFront certificate must live in us-east-1.

Copy link
Q13

Two accounts need private access to each other's APIs, with overlapping CIDRs. What do you build?

Advanced

Situation read โ†’ Overlapping CIDRs rule out VPC peering and Transit Gateway routing, so expose services rather than networks.

What I'd do โ†’

  1. In the provider account put the service behind an NLB and create a VPC endpoint service with aws ec2 create-vpc-endpoint-service-configuration --network-load-balancer-arns ...
  2. Whitelist the consumer account principal and require acceptance
  3. In the consumer account create an interface endpoint to the service name
  4. Consumer calls the endpoint's private DNS name, unaffected by CIDR overlap

Why โ†’ PrivateLink is one-directional and NAT-less at the packet level, so address overlap never matters.

Interview tip โ†’ Contrast: peering and TGW share routes, PrivateLink shares a service.

Copy link
Q14

The audit team requires that every S3 bucket in the org is encrypted and not public. How do you enforce and detect?

Intermediate

Situation read โ†’ Combine preventive controls (SCP, account settings) and detective controls (Config).

What I'd do โ†’

  1. Turn on S3 Block Public Access at the account level via aws s3control put-public-access-block and enforce through an SCP denying its removal
  2. Enable default SSE-S3 or SSE-KMS (default on since 2023) and add a bucket-policy or SCP that denies s3:PutObject without the expected encryption header when KMS is required
  3. Deploy Config managed rules s3-bucket-public-read-prohibited and s3-bucket-server-side-encryption-enabled through an org conformance pack
  4. Auto-remediate with SSM Automation

Why โ†’ Prevent what you can, detect the rest; either alone leaves gaps.

Interview tip โ†’ Mention Security Hub CSPM standards for an aggregated score.

Copy link
Q15

What is the difference between an IAM role and an IAM user, and when do you pick each?

Beginner

Situation read โ†’ A user is a long-lived identity with static credentials; a role is an assumable identity with temporary credentials.

What I'd do โ†’

  1. Use roles for EC2, Lambda, ECS tasks, cross-account access and CI
  2. Use SSO-federated roles for humans
  3. Reserve IAM users for rare cases like a third-party tool that cannot federate, and then rotate keys and restrict by condition
  4. Audit with the credential report: aws iam generate-credential-report

Why โ†’ Temporary credentials shrink the window of a leak from forever to hours.

Interview tip โ†’ One-line answer: "roles for everything, users almost never".

Copy link
Q16

A teammate says "just give it AdministratorAccess to get unblocked". How do you handle it properly?

Beginner

Situation read โ†’ Least privilege can be reached fast by letting AWS tell you what the app actually used.

What I'd do โ†’

  1. Allow the broad permission only in a dev account for a short window
  2. Run the workload, then use IAM Access Analyzer policy generation from CloudTrail: it builds a policy from observed calls
  3. Review the draft, replace wildcards with ARNs, and apply it
  4. Remove the admin policy and check aws iam get-role for attached policies

Why โ†’ Generated policies come from real activity so they are tighter than guesses.

Interview tip โ†’ Mention Access Analyzer unused-access findings for cleanup later.

Copy link
Q17

A policy has an Allow for s3:* but a user still gets AccessDenied on PutObject. List the places a deny can hide.

Intermediate

Situation read โ†’ Evaluation is explicit deny first, so I hunt for any deny across the layers.

What I'd do โ†’

  1. SCP in Organizations
  2. Permissions boundary on the role or user
  3. Session policy passed during assume-role
  4. Bucket policy with Deny conditions such as aws:SecureTransport or required encryption
  5. VPC endpoint policy
  6. Use the IAM policy simulator or aws iam simulate-principal-policy and CloudTrail errorMessage, which often names the deny type

Why โ†’ AWS error messages now say "explicit deny in a service control policy" or similar, which pinpoints the layer.

Interview tip โ†’ Recite the evaluation order: explicit deny, SCP, boundary, session, identity or resource allow.

Copy link
Q18

How do you give an on-premises server AWS access without IAM users?

Intermediate

Situation read โ†’ IAM Roles Anywhere issues temporary credentials against X.509 certificates, or SSM hybrid activation covers management tasks.

What I'd do โ†’

  1. Create a trust anchor from your private CA or ACM Private CA
  2. Create a profile mapping to an IAM role
  3. Install aws_signing_helper on the server and configure credential_process in the AWS profile
  4. Restrict the trust policy with a condition on the certificate subject

Why โ†’ The server proves identity by certificate rather than a stored secret, and credentials rotate automatically.

Interview tip โ†’ Mention certificate lifecycle as the new operational burden.

Copy link
Q19

A product team wants to give an external vendor limited access to one account. Design it safely.

Advanced

Situation read โ†’ Third-party access must prevent the confused deputy problem and be revocable.

What I'd do โ†’

  1. Create a role in your account trusting the vendor's account with sts:ExternalId condition set to a unique value you generate
  2. Attach a narrowly scoped policy plus a permissions boundary
  3. Require aws:MultiFactorAuthPresent only if their human flow supports it, otherwise limit by aws:SourceIp
  4. Alert on the role's use via CloudTrail and set MaxSessionDuration to 1 hour

Why โ†’ ExternalId stops another customer of the same vendor from tricking the vendor into using your role.

Interview tip โ†’ Say "confused deputy" by name.

Copy link
Q20

The finance team asks for monthly cost by team. How do you structure IAM and tagging to make that possible?

Intermediate

Situation read โ†’ Attribution needs enforcement at creation time, not a spreadsheet after the fact.

What I'd do โ†’

  1. Define tag keys (team, env, cost-center) and activate them as cost allocation tags in Billing
  2. Enforce with an SCP or tag policy and IAM condition aws:RequestTag/team on create actions
  3. Use an AWS Config rule required-tags to catch drift
  4. Use account-per-team where possible, since account boundary is the cleanest chargeback

Why โ†’ Untagged resources become unallocatable spend that nobody owns.

Interview tip โ†’ Mention that some services (data transfer, shared EKS) need split allocation tooling.

Copy link
Q21

Your SCP change accidentally locked everyone out of a production OU, including the pipeline. How do you recover?

Advanced

Situation read โ†’ SCPs do not apply to the management account, which is the recovery path.

What I'd do โ†’

  1. Sign in to the management account with an admin who has Organizations permissions
  2. Detach or fix the SCP: aws organizations detach-policy --policy-id p-xxxx --target-id ou-abcd-12345678
  3. Verify member-account calls work again
  4. Add a post-mortem action to roll out SCPs to a canary OU first with CloudTrail review

Why โ†’ Management account is exempt by design, which is also why you must keep workloads out of it.

Interview tip โ†’ Always keep FullAWSAccess attached alongside deny lists unless you intentionally use allow-list mode.

Copy link
Q22

How do you rotate IAM access keys used by a legacy app you cannot refactor quickly?

Intermediate

Situation read โ†’ Two keys per user permit zero-downtime rotation; automation prevents it from being forgotten.

What I'd do โ†’

  1. Create the second key: aws iam create-access-key --user-name legacy-app
  2. Store it in Secrets Manager and update the app configuration
  3. Confirm via aws iam get-access-key-last-used that the new key is in use
  4. Deactivate then delete the old key
  5. Schedule it with a Lambda or Secrets Manager rotation template, and alert via Config rule access-keys-rotated

Why โ†’ Overlap eliminates the outage window that makes teams avoid rotation.

Interview tip โ†’ Offer the long-term fix: move the app to a role.

Copy link
Q23

What does MFA enforcement for the console look like in a shared account, and how do you require it for API calls too?

Beginner

Situation read โ†’ Console MFA is easy; API MFA is enforced via a policy condition.

What I'd do โ†’

  1. Use SSO with MFA enforced in Identity Center settings
  2. For remaining IAM users attach a policy denying all except MFA-device management when aws:MultiFactorAuthPresent is false
  3. For API use, users call aws sts get-session-token --serial-number arn:aws:iam::111111111111:mfa/alice --token-code 123456
  4. Prefer hardware or passkey MFA for admins

Why โ†’ The deny-unless-MFA pattern gives enforcement even when the user has valid keys.

Interview tip โ†’ Mention root user MFA and no root access keys as the first hygiene items.

Copy link
Q24

An engineer left the company. How do you make sure nothing of theirs still works?

Intermediate

Situation read โ†’ Offboarding is easy if identity is centralized, hard if they created IAM users or keys.

What I'd do โ†’

  1. Disable the user in the IdP, which kills SSO sessions into every account
  2. Run the credential report to find any IAM users or keys: aws iam get-credential-report
  3. Search for roles they created with trust to personal accounts
  4. Rotate any shared secrets they knew
  5. Check CloudTrail for the user's actions the final week

Why โ†’ Central IdP removal handles 95 percent of access; the remainder is the shadow credentials.

Interview tip โ†’ Mention periodic IAM Access Analyzer external-access findings.

Copy link
Q25

Walk me through how you would implement least privilege at scale for 200 roles that currently have wide permissions.

Advanced

Situation read โ†’ You cannot hand-review 200 roles, so use data to shrink them in waves.

What I'd do โ†’

  1. Enable Access Analyzer unused-access analyzer at the org level
  2. Rank roles by findings of unused permissions and unused roles
  3. Generate policies from CloudTrail for the top risks, replace with scoped ones in lower environments first
  4. Roll to prod behind a monitored change window with the old policy kept for rollback
  5. Add policy-as-code checks (IAM Access Analyzer validate-policy or cfn-guard) in CI

Why โ†’ Iterative tightening with rollback beats a big-bang rewrite that breaks production.

Interview tip โ†’ Mention that you measure progress by unused-permission count dropping.

Copy link

VPC and Networking

๐ŸŽฅ Learn this hands-on with DevOps Shack โ†’ YouTube @devopsshack ยท Hindi @shackverse ยท Courses at devopsshack.com

Q26

You are asked to design a VPC for a three-tier web app. What does the layout look like?

Beginner

Situation read โ†’ Public only for what must face the internet; everything else private across at least two AZs.

What I'd do โ†’

  1. Pick a /16 such as 10.20.0.0/16 and carve /20 or /24 subnets per tier per AZ
  2. Public subnets hold ALB and NAT gateways, private app subnets hold compute, isolated data subnets hold RDS with no internet route
  3. Route tables: public to IGW, private to NAT, data with local only
  4. Security groups chained: ALB to app to DB by SG reference

Why โ†’ Tier isolation and SG referencing limit lateral movement and keep rules readable.

Interview tip โ†’ Leave spare CIDR space; resizing a VPC later hurts.

Copy link
Q27

Instances in a private subnet cannot reach the internet to download packages. What do you add?

Beginner

Situation read โ†’ Private subnets need an outbound path, typically a NAT gateway in a public subnet.

What I'd do โ†’

  1. Create a NAT gateway in a public subnet with an Elastic IP
  2. Add 0.0.0.0/0 -> nat-0abc to the private route table
  3. Test from the instance: curl -sI https://example.com
  4. For one NAT per AZ, add one route table per AZ

Why โ†’ NAT gives outbound-only access; inbound connections from the internet still cannot be initiated.

Interview tip โ†’ Mention NAT cost and the gateway endpoint alternative for S3 and DynamoDB.

Copy link
Q28

Your NAT gateway bill is $4,000 a month. How do you cut it?

Intermediate

Situation read โ†’ NAT charges per hour and per GB; most heavy traffic is usually to AWS services or ECR and S3.

What I'd do โ†’

  1. Use VPC Flow Logs or CloudWatch metric BytesOutToDestination to find top talkers
  2. Add free gateway endpoints for S3 and DynamoDB
  3. Add interface endpoints for ECR, STS, CloudWatch Logs where traffic is high, since endpoint per-GB cost is lower than NAT
  4. Keep chatty cross-AZ traffic in the same AZ as its NAT
  5. Consider NAT instances only for dev environments

Why โ†’ Most NAT spend is avoidable traffic to AWS public endpoints.

Interview tip โ†’ Mention that cross-AZ data transfer through NAT adds a second charge.

Copy link
Q29

What is the difference between a security group and a network ACL, and when would you touch NACLs?

Beginner

Situation read โ†’ SGs are stateful and attach to ENIs; NACLs are stateless and attach to subnets.

What I'd do โ†’

  1. Default to SGs for all allow rules
  2. Use NACLs for coarse subnet-wide denies such as blocking a hostile CIDR
  3. Remember NACL rules need both inbound and outbound with ephemeral ports 1024-65535
  4. Inspect: aws ec2 describe-network-acls --filters Name=vpc-id,Values=vpc-0abc

Why โ†’ SG rules are allow-only, NACLs support explicit deny and are evaluated in rule-number order.

Interview tip โ†’ State the "stateful vs stateless" contrast first.

Copy link
Q30

Connect 30 VPCs across 10 accounts with shared on-prem connectivity. VPC peering or Transit Gateway?

Intermediate

Situation read โ†’ Peering is non-transitive and creates a mesh; TGW is a hub with route tables.

What I'd do โ†’

  1. Create a TGW in the network account and share it with RAM across the org
  2. Attach each VPC and the VPN or Direct Connect gateway
  3. Use separate TGW route tables to segment prod from dev
  4. Add VPC route 10.0.0.0/8 -> tgw-0abc and test with Reachability Analyzer

Why โ†’ Peering scales as n squared; TGW scales linearly and supports central egress and inspection.

Interview tip โ†’ Know the TGW cost: per attachment per hour plus per GB.

Copy link
Q31

Design hybrid connectivity to on-prem that survives a link failure.

Intermediate

Situation read โ†’ Redundancy must exist at the device, circuit and path level.

What I'd do โ†’

  1. Primary: Direct Connect, ideally two connections at different locations
  2. Backup: Site-to-Site VPN over the internet attached to the same Transit Gateway or Virtual Private Gateway
  3. Use BGP on both with local preference or AS-path prepending favoring DX
  4. Enable BFD and test failover by shutting one path
  5. Monitor TunnelState and DX ConnectionState metrics

Why โ†’ DX gives predictable latency; VPN gives fast, cheap insurance with automatic BGP failover.

Interview tip โ†’ A single DX is a single point of failure; say so.

Copy link
Q32

Traffic from your VPC to S3 goes through the NAT gateway. How do you keep it on the AWS network and add control?

Intermediate

Situation read โ†’ A gateway endpoint routes S3 traffic privately and allows policy control at no charge.

What I'd do โ†’

  1. Create the endpoint: aws ec2 create-vpc-endpoint --vpc-id vpc-0abc --service-name com.amazonaws.eu-west-1.s3 --route-table-ids rtb-0abc
  2. Attach an endpoint policy restricting access to your buckets
  3. Add a bucket policy condition aws:SourceVpce so the bucket is only reachable through the endpoint
  4. Verify with traceroute or route table entry for the prefix list

Why โ†’ The endpoint adds a prefix-list route that wins over the default route, so NAT is bypassed.

Interview tip โ†’ Gateway endpoints exist only for S3 and DynamoDB; everything else uses interface endpoints.

Copy link
Q33

You must inspect all egress traffic from 50 VPCs centrally. What is the architecture?

Advanced

Situation read โ†’ Centralized egress with an inspection VPC behind Transit Gateway.

What I'd do โ†’

  1. Spoke VPCs send 0.0.0.0/0 to the TGW
  2. TGW route table for spokes points to an inspection VPC attachment with appliance mode enabled
  3. Inspection VPC runs AWS Network Firewall or third-party firewalls behind a Gateway Load Balancer
  4. Firewall subnets forward to NAT gateways in an egress VPC
  5. Return path via TGW; enable flow logs on all attachments

Why โ†’ Appliance mode keeps both directions of a flow on the same AZ so stateful inspection works.

Interview tip โ†’ Mention the cost and single-choke-point trade-off versus per-VPC firewalls.

Copy link
Q34

Two services in different AZs talk constantly and the cross-AZ data transfer charge is rising. What do you do?

Intermediate

Situation read โ†’ Cross-AZ traffic costs about a cent per GB each direction, which adds up for chatty tiers.

What I'd do โ†’

  1. Identify with Cost Explorer usage type DataTransfer-Regional-Bytes and flow logs
  2. Prefer zone-aware routing: Kubernetes topology-aware routing or ALB zonal affinity
  3. Keep caches and replicas per AZ
  4. Accept cross-AZ for HA-critical paths such as DB replication
  5. Re-measure after the change

Why โ†’ Resilience needs multi-AZ, but balancing locality and failover captures savings.

Interview tip โ†’ Don't suggest single-AZ for production just to save money.

Copy link
Q35

A new subnet's instances cannot be reached via SSH from the internet. Walk through the checks.

Beginner

Situation read โ†’ Connectivity needs an IGW route, a public IP, an SG rule and a NACL that allows it.

What I'd do โ†’

  1. Subnet route table has 0.0.0.0/0 -> igw-...
  2. Instance has a public or Elastic IP
  3. SG allows TCP 22 from your IP
  4. NACL allows inbound 22 and outbound ephemeral ports
  5. Better, remove public SSH entirely and use SSM Session Manager: aws ssm start-session --target i-0abc

Why โ†’ Each layer can independently block; checking in packet order finds the break quickly.

Interview tip โ†’ Suggest Session Manager as the modern replacement.

Copy link
Q36

How would you give private instances access to AWS Systems Manager without NAT or public IPs?

Intermediate

Situation read โ†’ SSM needs three interface endpoints in the VPC.

What I'd do โ†’

  1. Create endpoints ssm, ssmmessages and ec2messages with private DNS enabled
  2. Attach an SG allowing 443 from the instance subnets
  3. Ensure the instance role has AmazonSSMManagedInstanceCore
  4. Test: instance appears in aws ssm describe-instance-information

Why โ†’ Instances reach SSM purely on the AWS backbone, shrinking attack surface.

Interview tip โ†’ Forgetting ssmmessages is the usual reason Session Manager fails.

Copy link
Q37

Two VPCs peered, but the app in VPC A cannot reach VPC B's database. What is the routine?

Intermediate

Situation read โ†’ Peering needs routes on both sides plus SG and DNS settings.

What I'd do โ†’

  1. Check peering is active: aws ec2 describe-vpc-peering-connections
  2. Add routes in both VPC route tables to the peer CIDR
  3. Check the DB SG allows the source CIDR or the peer SG reference (cross-account SG references work only in the same region)
  4. Check NACLs
  5. Enable DNS resolution over peering if using private hostnames

Why โ†’ Peering creates a path only; routing and filtering are still your job.

Interview tip โ†’ Peering never routes through a third VPC.

Copy link
Q38

Design IPv6 adoption for a dual-stack app to reduce NAT costs.

Advanced

Situation read โ†’ IPv6 addresses are globally routable, so private egress uses an egress-only internet gateway instead of NAT.

What I'd do โ†’

  1. Associate an Amazon-provided /56 with the VPC and /64 with subnets
  2. Add ::/0 -> eigw-0abc in private route tables
  3. Enable dual-stack on the ALB (--ip-address-type dualstack)
  4. Update SGs with IPv6 rules
  5. Keep NAT64 and DNS64 for IPv4-only destinations

Why โ†’ IPv6 egress via EIGW has no hourly or per-GB NAT fee, and public IPv4 addresses now cost money too.

Interview tip โ†’ Remember that public IPv4 charges began in 2024; it drives IPv6 interest.

Copy link
Q39

An application needs a stable outbound IP that a partner can whitelist. How?

Intermediate

Situation read โ†’ Outbound IPs come from NAT gateway Elastic IPs, which are stable.

What I'd do โ†’

  1. Create a NAT gateway with an allocated EIP in each AZ
  2. Route private subnets through it
  3. Give the partner all EIPs
  4. For Lambda, place it in the VPC private subnets so egress uses the NAT
  5. Verify curl https://checkip.amazonaws.com

Why โ†’ Auto-assigned public IPs change on stop/start, Elastic IPs and NAT EIPs do not.

Interview tip โ†’ Mention you need all AZ EIPs on the allowlist, not just one.

Copy link
Q40

You must expose an internal service to 200 customer VPCs privately without peering. What do you build?

Intermediate

Situation read โ†’ PrivateLink endpoint service scales to many consumers with no CIDR coordination.

What I'd do โ†’

  1. Put the service behind an NLB
  2. Create the endpoint service and allow principals by account or org
  3. Enable acceptance if you want control
  4. Consumers create interface endpoints, optionally with private DNS names verified on your domain
  5. Monitor ActiveConnections and use cross-zone settings

Why โ†’ Consumers get a local ENI in their subnets, so there is no routing or overlap issue.

Interview tip โ†’ Mention that NLB is required (or GWLB for appliances).

Copy link
Q41

What is a VPC flow log and how would you use it when a connection is mysteriously dropped?

Beginner

Situation read โ†’ Flow logs record accepted and rejected flows per ENI, subnet or VPC.

What I'd do โ†’

  1. Enable: aws ec2 create-flow-logs --resource-type VPC --resource-ids vpc-0abc --traffic-type ALL --log-destination-type s3 --log-destination arn:aws:s3:::flowlogs-bucket
  2. Query with Athena for action = 'REJECT' on the destination IP and port
  3. Distinguish SG vs NACL: stateless NACL rejects often show up on return traffic
  4. Fix the rule that shows the REJECT

Why โ†’ Flow logs show whether traffic reached the ENI and was refused, narrowing blame to the network.

Interview tip โ†’ Flow logs exclude DNS to Route 53 resolver and IMDS traffic.

Copy link
Q42

The ALB health checks fail only for targets in one subnet. What could differ?

Intermediate

Situation read โ†’ One subnet differs in routing, NACL, or SG source.

What I'd do โ†’

  1. Compare NACLs on the failing subnet for the health check port
  2. Confirm the target SG allows the ALB SG on the health check port
  3. Confirm the subnet is enabled for the ALB's AZ
  4. Check the instance's local firewall and app listening address with ss -ltnp

Why โ†’ Health checks originate from ALB ENIs in the enabled subnets, so subnet-level rules matter.

Interview tip โ†’ Mention app binding to 127.0.0.1 as the classic cause.

Copy link
Q43

Your company is acquiring another with the same 10.0.0.0/16. How do you integrate networks?

Advanced

Situation read โ†’ Overlap blocks direct routing; options are renumbering, NAT or service-level exposure.

What I'd do โ†’

  1. Short term: expose only needed services with PrivateLink
  2. Or use a private NAT gateway with a non-overlapping translation range via Transit Gateway
  3. Long term: renumber one side to a new range during migrations, and plan with IPAM
  4. Adopt Amazon VPC IPAM to prevent new overlaps

Why โ†’ Private NAT lets overlapping networks talk with translated addresses without renumbering first.

Interview tip โ†’ Mention secondary CIDR associations for new workloads.

Copy link
Q44

How would you secure a VPC against data exfiltration to the internet?

Intermediate

Situation read โ†’ Default-deny egress with allow-listed destinations and visibility.

What I'd do โ†’

  1. Remove public IPs, route egress through NAT and AWS Network Firewall using domain-list rules
  2. Tighten SG egress rules
  3. Use Route 53 Resolver DNS Firewall to block unknown domains
  4. Add endpoint policies for S3 to restrict to your buckets
  5. Alert on GuardDuty exfiltration findings

Why โ†’ DNS and S3 are the typical exfiltration paths, so control both.

Interview tip โ†’ SG default egress allows all; mention that you tighten it.

Copy link
Q45

What happens when you delete the default VPC and why might you?

Beginner

Situation read โ†’ Default VPCs have public subnets and permissive defaults that bypass your network design.

What I'd do โ†’

  1. Delete in every region via CLI, including subnets, IGW and the VPC
  2. Prevent recreation of workloads in them using an SCP and detect with Config
  3. If needed, aws ec2 create-default-vpc restores it

Why โ†’ Removing it prevents people launching instances into an unmanaged, internet-routable network.

Interview tip โ†’ Mention doing it for all regions, not just the one you use.

Copy link
Q46

Latency between two regions is high for a replication job. What network options exist?

Intermediate

Situation read โ†’ Public internet paths vary; AWS backbone options offer more consistency.

What I'd do โ†’

  1. Use inter-region VPC peering or Transit Gateway peering, which stay on the AWS backbone
  2. Check throughput limits and use multiple flows because single-flow bandwidth is limited
  3. For S3 use Cross-Region Replication, for DBs use native replication
  4. Test with iperf3 across two instances

Why โ†’ Backbone traffic is encrypted and avoids congestion hotspots on the public internet.

Interview tip โ†’ Know that single TCP flow caps at about 5 Gbps within a placement group and less across regions.

Copy link
Q47

Design DNS for a hybrid environment where on-prem and AWS must resolve each other's private names.

Advanced

Situation read โ†’ Route 53 Resolver endpoints forward in both directions.

What I'd do โ†’

  1. Create an inbound endpoint so on-prem DNS can forward *.aws.internal to it
  2. Create an outbound endpoint and forwarding rule for corp.example.com to on-prem DNS servers
  3. Share rules via RAM across accounts
  4. Associate private hosted zones with all VPCs
  5. Test with dig @10.0.1.10 db.aws.internal from on-prem

Why โ†’ Resolver endpoints bridge the VPC's .2 resolver and external servers without running your own DNS fleet.

Interview tip โ†’ Put endpoints in at least two AZs.

Copy link
Q48

An EKS cluster ran out of IP addresses in its subnets. What do you do?

Intermediate

Situation read โ†’ The VPC CNI assigns a VPC IP per pod, so small subnets exhaust quickly.

What I'd do โ†’

  1. Associate a secondary CIDR such as 100.64.0.0/16 with the VPC
  2. Enable custom networking so pods use the new subnets
  3. Or enable prefix delegation: kubectl set env daemonset aws-node -n kube-system ENABLE_PREFIX_DELEGATION=true
  4. Long term, size subnets larger from the start

Why โ†’ Secondary CIDRs expand capacity without re-IPing nodes.

Interview tip โ†’ Mention IPv6 EKS clusters avoid the problem entirely.

Copy link
Q49

How do you restrict an S3 bucket so it is reachable only from your VPC?

Intermediate

Situation read โ†’ Combine a gateway endpoint with a bucket policy condition.

What I'd do โ†’

  1. Add a Deny statement with StringNotEquals on aws:SourceVpce equal to vpce-0abc
  2. Keep an exception for admin roles or the console flow
  3. Test from inside and outside the VPC
  4. Don't lock out CloudFormation or other AWS service principals

Why โ†’ A deny-unless-endpoint policy blocks leaked credentials used from outside.

Interview tip โ†’ Mention the risk of locking out yourself; test with a break-glass role.

Copy link
Q50

Design a multi-AZ NAT strategy and justify cost versus resilience.

Advanced

Situation read โ†’ One NAT gateway per AZ avoids cross-AZ charges and an AZ-failure blast radius.

What I'd do โ†’

  1. Deploy a NAT gateway in each public subnet
  2. Per-AZ private route tables point to the NAT in the same AZ
  3. For dev, use one NAT to save about $32 per month per gateway
  4. Alarm on ErrorPortAllocation and PacketsDropCount
  5. Use IPv6 or endpoints to reduce the load

Why โ†’ An AZ outage with a single NAT takes all private-subnet egress with it.

Interview tip โ†’ Prod: one per AZ. Non-prod: one shared.

Copy link
Q51

What is the purpose of an Elastic IP and what is the downside of leaving them unattached?

Beginner

Situation read โ†’ EIP is a static public IPv4 owned by the account.

What I'd do โ†’

  1. Allocate: aws ec2 allocate-address --domain vpc
  2. Associate with an instance or NAT gateway
  3. List unassociated: aws ec2 describe-addresses --query 'Addresses[?AssociationId==null]'
  4. Release those you do not need

Why โ†’ Public IPv4 addresses are billed hourly whether or not attached.

Interview tip โ†’ Prefer DNS and load balancers over EIPs for services.

Copy link

EC2, Auto Scaling and Load Balancing

๐ŸŽฅ Learn this hands-on with DevOps Shack โ†’ YouTube @devopsshack ยท Hindi @shackverse ยท Courses at devopsshack.com

Q52

Traffic doubles every Friday evening. How do you make the web tier handle it automatically?

Beginner

Situation read โ†’ Predictable spikes call for scheduled scaling plus a reactive policy as a safety net.

What I'd do โ†’

  1. Put instances in an Auto Scaling group across at least two AZs behind an ALB
  2. Add a target tracking policy on ALBRequestCountPerTarget or CPU at 50 to 60 percent
  3. Add a scheduled action to raise MinSize Friday at 16:00
  4. Use a launch template with a baked AMI so instances are ready in under two minutes

Why โ†’ Scheduled capacity removes cold-start lag, target tracking handles the surprise.

Interview tip โ†’ Mention predictive scaling for repeating patterns.

Copy link
Q53

What is the difference between an ALB, an NLB and a Gateway Load Balancer?

Beginner

Situation read โ†’ They operate at different layers for different jobs.

What I'd do โ†’

  1. ALB is layer 7: host and path routing, redirects, OIDC auth, WebSocket and gRPC
  2. NLB is layer 4: TCP, UDP, TLS, static IPs per AZ, extreme throughput, PrivateLink backend
  3. GWLB is layer 3: transparent insertion of firewalls and inspection appliances over GENEVE
  4. Choose ALB for HTTP microservices, NLB for non-HTTP or fixed IP, GWLB for appliances

Why โ†’ Matching layer to need avoids paying for features you do not use.

Interview tip โ†’ NLB preserves client IP by default for instance targets.

Copy link
Q54

You deploy a new version to an ASG without downtime. Which approach do you use?

Intermediate

Situation read โ†’ Instance refresh with health-gated batches or blue/green with two target groups.

What I'd do โ†’

  1. Update the launch template version
  2. Start: aws autoscaling start-instance-refresh --auto-scaling-group-name web --preferences '{"MinHealthyPercentage":90,"InstanceWarmup":120}'
  3. Watch with describe-instance-refresh
  4. For safer cutovers use a second ASG and weighted ALB target groups, then shift 10, 50, 100 percent

Why โ†’ Refresh replaces instances gradually, honoring health so capacity never drops below the floor.

Interview tip โ†’ Mention checkpoints and auto-rollback preferences.

Copy link
Q55

Instances in an ASG keep getting terminated and replaced in a loop. What is going on?

Intermediate

Situation read โ†’ Health checks are failing before the app is ready, or user data is crashing.

What I'd do โ†’

  1. Look at the activity history: aws autoscaling describe-scaling-activities --auto-scaling-group-name web
  2. Check cause text such as "Terminating EC2 instance: health check type ELB"
  3. Increase HealthCheckGracePeriod beyond boot plus app start time
  4. Read /var/log/cloud-init-output.log via a suspended instance
  5. Use aws autoscaling suspend-processes --scaling-processes ReplaceUnhealthy to debug

Why โ†’ ELB health checks start immediately after grace period; a slow boot keeps tripping them.

Interview tip โ†’ Suspending ReplaceUnhealthy is the debug trick that proves you have done this.

Copy link
Q56

You want to save up to 70 percent on a stateless batch fleet. What do you design?

Intermediate

Situation read โ†’ Spot Instances with diversification and interruption handling.

What I'd do โ†’

  1. Use an ASG mixed instances policy across 8 to 10 instance types and all AZs with allocation strategy price-capacity-optimized
  2. Keep a small On-Demand base
  3. Handle the two-minute interruption notice via EventBridge or IMDS to drain and checkpoint
  4. Use SQS so work is retried on interruption
  5. Enable capacity rebalancing

Why โ†’ Diversified pools lower the chance that one capacity pool dries up.

Interview tip โ†’ Never run stateful singletons on Spot.

Copy link
Q57

Choose between Savings Plans and Reserved Instances for a steady fleet that is changing instance families.

Intermediate

Situation read โ†’ Compute Savings Plans keep flexibility across family, region and even Fargate and Lambda.

What I'd do โ†’

  1. Review usage in Cost Explorer Savings Plans recommendations
  2. Commit to roughly 70 to 80 percent of the steady baseline, not peak
  3. Choose Compute SP for flexibility, EC2 Instance SP for a higher discount when family is fixed
  4. Use RIs only for specific cases such as RDS or capacity reservations
  5. Revisit quarterly

Why โ†’ Over-commitment wastes money; under-commitment leaves discount on the table.

Interview tip โ†’ Savings Plans do not reserve capacity; RIs with zonal scope do.

Copy link
Q58

A stopped-and-started EC2 instance changed its public IP and broke the DNS record. How do you prevent that?

Beginner

Situation read โ†’ Auto-assigned public IPs are released on stop.

What I'd do โ†’

  1. Put a load balancer in front and point DNS at it
  2. Or associate an Elastic IP
  3. Or use a Route 53 alias to the ALB
  4. Avoid pointing DNS at instance IPs

Why โ†’ Load balancer DNS names are stable endpoints that survive instance replacement.

Interview tip โ†’ Treat instances as cattle.

Copy link
Q59

An ALB returns 502 intermittently during deployments. How do you stop that?

Intermediate

Situation read โ†’ Targets are being deregistered with in-flight requests, or the app closes keep-alive connections early.

What I'd do โ†’

  1. Set deregistration delay to match the longest request, such as 30 to 60 seconds
  2. Make the app handle SIGTERM and finish requests
  3. Set app keep-alive timeout greater than the ALB idle timeout (60 s default)
  4. Use slow start for new targets
  5. Check HTTPCode_ELB_502_Count and target response time metrics

Why โ†’ A backend closing idle connections sooner than the ALB expects causes 502s on reused connections.

Interview tip โ†’ State the rule: backend keep-alive greater than load balancer idle timeout.

Copy link
Q60

Design a zero-downtime blue/green for a monolith on EC2 behind an ALB.

Advanced

Situation read โ†’ Two environments, one listener, weighted shift with fast rollback.

What I'd do โ†’

  1. Create blue and green ASGs, each with its own target group
  2. Deploy the new AMI to green and run smoke tests against a test listener on port 8443
  3. Shift listener weights 10, 50, 100 percent with alarms on 5xx and latency
  4. Keep blue running for 30 minutes then scale to zero
  5. Roll back by flipping weights back: aws elbv2 modify-listener --listener-arn ... --default-actions ...

Why โ†’ Rollback is a weight change, not a redeploy, so recovery takes seconds.

Interview tip โ†’ Mention database migrations must be backward compatible for this to work.

Copy link
Q61

An EC2 instance is running at 100 percent CPU with CPU credits at zero. What happened?

Intermediate

Situation read โ†’ A burstable T-family instance exhausted its credits and is throttled to baseline.

What I'd do โ†’

  1. Confirm CPUCreditBalance in CloudWatch
  2. Switch to unlimited mode: aws ec2 modify-instance-credit-specification
  3. Or right-size to M or C family
  4. Or scale out with an ASG
  5. Compare costs; unlimited bills surplus credits

Why โ†’ T instances are cheap only for low average CPU; sustained load needs fixed-performance instances.

Interview tip โ†’ Never run steady production CPU on T-class without unlimited.

Copy link
Q62

Your ASG launched instances in only one AZ and an AZ outage took down the service. Why?

Intermediate

Situation read โ†’ The ASG was configured with a single subnet, or the AZs were imbalanced.

What I'd do โ†’

  1. Check aws autoscaling describe-auto-scaling-groups for AvailabilityZones
  2. Add subnets across 3 AZs
  3. Make sure the ALB has those AZs enabled
  4. Enable AZ rebalancing
  5. Test with an AZ failure drill using ARC zonal shift

Why โ†’ Multi-AZ is only real if both the ALB and the ASG span it with enough capacity per AZ.

Interview tip โ†’ Mention over-provisioning N+1 across AZs.

Copy link
Q63

How would you connect to a private EC2 instance for troubleshooting without a bastion?

Beginner

Situation read โ†’ Use Systems Manager Session Manager.

What I'd do โ†’

  1. Ensure the instance has AmazonSSMManagedInstanceCore
  2. Start: aws ssm start-session --target i-0abc
  3. For port forwarding use --document-name AWS-StartPortForwardingSession --parameters portNumber=5432,localPortNumber=5432
  4. Session logs go to S3 or CloudWatch for audit

Why โ†’ No inbound ports, no SSH keys, and every session is audited.

Interview tip โ†’ Mention EC2 Instance Connect Endpoint as another keyless option.

Copy link
Q64

The business requires 99.99 percent for a customer API. How do you compose EC2 components?

Intermediate

Situation read โ†’ Multi-AZ everything, no single points, and automated recovery.

What I'd do โ†’

  1. ALB across three AZs, ASG with min 3
  2. Stateless instances, state in DynamoDB or Multi-AZ Aurora
  3. Health checks at ELB level, deep health endpoints
  4. Route 53 health checks with failover to a second region if needed
  5. Error budget alarms and game-day tests

Why โ†’ Availability multiplies; each tier must itself be redundant.

Interview tip โ†’ Be honest about regional dependencies like IAM and Route 53 control planes.

Copy link
Q65

Right-size a fleet of 300 instances where nobody knows actual usage. How?

Advanced

Situation read โ†’ Data-driven right-sizing with guardrails, not guessing.

What I'd do โ†’

  1. Enable Compute Optimizer across the org and install CloudWatch agent for memory metrics
  2. Pull recommendations: aws compute-optimizer get-ec2-instance-recommendations
  3. Sort by savings and risk, start with over-provisioned dev and staging
  4. Change one size down at a time and watch p99 latency
  5. Move to Graviton (m7g, c7g) where the stack supports ARM

Why โ†’ CPU-only data misses memory pressure; the agent metric makes the call accurate.

Interview tip โ†’ Graviton typically gives 20 percent better price-performance.

Copy link
Q66

User data script ran but the app is not installed. How do you debug a new launch template?

Intermediate

Situation read โ†’ User data runs once at first boot as root through cloud-init, and failures are silent unless you look.

What I'd do โ†’

  1. SSM into the instance and read /var/log/cloud-init-output.log
  2. Run cloud-init status --long
  3. Check the script has a shebang and set -euxo pipefail
  4. Verify the instance has outbound access for package repositories
  5. Fix the template and refresh

Why โ†’ Most user data failures are no network path or a missing shebang.

Interview tip โ†’ Better: bake an AMI with EC2 Image Builder so boot does less.

Copy link
Q67

What is the difference between an AMI, a snapshot and an instance store?

Beginner

Situation read โ†’ AMI is a template, a snapshot is a block-level backup in S3, instance store is ephemeral local disk.

What I'd do โ†’

  1. Create an AMI from an instance: aws ec2 create-image --instance-id i-0abc --name web-v12
  2. Snapshots back EBS volumes and are incremental
  3. Instance store data is lost on stop or termination
  4. Use it only for caches or scratch

Why โ†’ Knowing which storage persists is basic to not losing data.

Interview tip โ†’ EBS persists after stop; instance store does not.

Copy link
Q68

Your fleet needs OS patching monthly with no manual SSH. How do you automate it?

Intermediate

Situation read โ†’ Systems Manager Patch Manager with maintenance windows.

What I'd do โ†’

  1. Tag instances by PatchGroup
  2. Create a patch baseline and a maintenance window
  3. Register the AWS-RunPatchBaseline task with rate control (10 percent concurrency, 5 percent error threshold)
  4. Combine with ASG instance refresh to bake new AMIs instead of in-place patching for immutable fleets
  5. Report compliance in the console

Why โ†’ Immutable AMI rotation beats patching in place for repeatability.

Interview tip โ†’ Mention rate control to avoid patching the whole fleet at once.

Copy link
Q69

An ALB must route /api to one service and / to another, and also redirect HTTP to HTTPS. How?

Intermediate

Situation read โ†’ Listener rules handle path routing and redirects natively.

What I'd do โ†’

  1. Listener 80: default action redirect to HTTPS 443 with status 301
  2. Listener 443 with ACM certificate and a rule path-pattern /api/* forwarding to the api target group
  3. Default action forward to the web target group
  4. Check rule priority order
  5. aws elbv2 describe-rules --listener-arn ...

Why โ†’ Rules evaluate in priority order, so specific paths must come before the catch-all.

Interview tip โ†’ Mention host-header rules for multi-tenant routing.

Copy link
Q70

You need zero-downtime AZ failover and a way to rehearse it. What tool do you use?

Advanced

Situation read โ†’ Application Recovery Controller zonal shift moves traffic away from an impaired AZ.

What I'd do โ†’

  1. Enable zonal shift on the ALB or NLB
  2. Run aws arc-zonal-shift start-zonal-shift --resource-identifier <alb-arn> --away-from eu-west-1a --expires-in 1h --comment drill
  3. Watch capacity and latency in the other AZs
  4. Pre-scale so remaining AZs can absorb the load
  5. Practice quarterly

Why โ†’ Shifting traffic is reversible and quick, and rehearsal exposes under-provisioned AZs.

Interview tip โ†’ Static stability: do not depend on control plane actions during a failure.

Copy link
Q71

An EC2 instance cannot be launched with "InsufficientInstanceCapacity". What are your options?

Intermediate

Situation read โ†’ The AZ is out of that instance type right now.

What I'd do โ†’

  1. Retry in another AZ or subnet
  2. Use a different instance type or size, or price-capacity-optimized flexibility
  3. For critical capacity use On-Demand Capacity Reservations
  4. Use attribute-based instance type selection in the ASG
  5. Don't hardcode one type

Why โ†’ Flexibility across types and AZs is the best protection against capacity errors.

Interview tip โ†’ Reserve capacity ahead of events like a launch.

Copy link
Q72

Choose between EBS volume types for a database needing 10,000 IOPS consistently.

Intermediate

Situation read โ†’ gp3 for most; io2 when sustained high IOPS and durability matter.

What I'd do โ†’

  1. gp3 lets you provision IOPS (up to 16,000) and throughput independent of size
  2. io2 Block Express goes to 256,000 IOPS with 99.999 percent durability
  3. Check the instance limit too, since EBS-optimized bandwidth caps
  4. Modify live: aws ec2 modify-volume --volume-id vol-0abc --volume-type gp3 --iops 10000

Why โ†’ gp3 is about 20 percent cheaper than gp2 and decouples performance from size.

Interview tip โ†’ Mention instance-level EBS throughput as a hidden cap.

Copy link
Q73

Design a self-healing stateful service on EC2, such as a leader-based cluster, with EBS volumes.

Advanced

Situation read โ†’ EBS is AZ-bound, so replacement logic must re-attach or rebuild in the same AZ.

What I'd do โ†’

  1. One ASG per AZ with min and max 1, or lifecycle hooks that attach the volume
  2. Tag volumes and attach with a user data script using the instance's AZ
  3. Prefer replicated data (rebuild from peers) over reattachment
  4. Use EBS snapshots through Data Lifecycle Manager
  5. Alarm on replication lag

Why โ†’ Rebuild-from-peer avoids long reattach waits and corruption risk from forced detach.

Interview tip โ†’ If possible, push state to a managed service.

Copy link
Q74

What is a placement group and when would you use one?

Beginner

Situation read โ†’ Placement groups control how instances are placed on hardware.

What I'd do โ†’

  1. Cluster: low latency, high throughput, one AZ (HPC, tightly coupled)
  2. Spread: each instance on distinct hardware, max 7 per AZ, for critical small groups
  3. Partition: groups of instances on distinct racks, for Kafka, Cassandra
  4. Create: aws ec2 create-placement-group --group-name hpc --strategy cluster

Why โ†’ The strategy trades off latency against blast-radius.

Interview tip โ†’ Cluster is a single-AZ risk.

Copy link
Q75

Pick the target type for an ALB serving Lambda, instances and IPs in the same system.

Intermediate

Situation read โ†’ Target groups can be instance, IP or Lambda type.

What I'd do โ†’

  1. Instance for ASG-managed hosts
  2. IP for containers on awsvpc networking, peered or on-prem addresses
  3. Lambda for serverless endpoints, invoked synchronously
  4. Weighted forwarding lets you migrate gradually between types

Why โ†’ One ALB can front mixed backends during migrations.

Interview tip โ†’ ECS with awsvpc must use IP targets.

Copy link

S3, RDS and DynamoDB

๐ŸŽฅ Learn this hands-on with DevOps Shack โ†’ YouTube @devopsshack ยท Hindi @shackverse ยท Courses at devopsshack.com

Q76

You need to host a static website with HTTPS and low latency worldwide. Which services do you use?

Beginner

Situation read โ†’ S3 as private origin, CloudFront as the public face.

What I'd do โ†’

  1. Create a private bucket, no static website hosting endpoint required
  2. Create a CloudFront distribution with Origin Access Control to the bucket
  3. Attach an ACM certificate from us-east-1 and add the domain as alternate name
  4. Route 53 alias record to the distribution
  5. Default root object index.html, plus custom error response for SPA routes

Why โ†’ OAC keeps the bucket private so content is only reachable through the CDN.

Interview tip โ†’ Note OAC replaced the older Origin Access Identity.

Copy link
Q77

Uploaded files in your bucket must be deleted after 90 days and old versions after 30. How do you do that?

Beginner

Situation read โ†’ S3 lifecycle rules.

What I'd do โ†’

  1. Enable versioning
  2. Add a rule: expire current objects after 90 days, NoncurrentVersionExpiration 30 days, and abort incomplete multipart uploads after 7 days
  3. Apply: aws s3api put-bucket-lifecycle-configuration --bucket app-uploads --lifecycle-configuration file://lifecycle.json
  4. Verify with get-bucket-lifecycle-configuration

Why โ†’ Lifecycle is free automation that stops storage costs creeping up.

Interview tip โ†’ Mention incomplete multipart uploads as hidden cost.

Copy link
Q78

Someone deleted objects from a versioned bucket. How do you recover and prevent repeats?

Intermediate

Situation read โ†’ With versioning on, a delete adds a delete marker; the data is still there.

What I'd do โ†’

  1. List versions: aws s3api list-object-versions --bucket b --prefix path/
  2. Remove the delete marker: aws s3api delete-object --bucket b --key path/file --version-id <marker-id>
  3. Turn on MFA delete or Object Lock for critical data
  4. Add a bucket policy denying s3:DeleteObjectVersion to most principals
  5. Consider replication to a second account

Why โ†’ Deleting the marker restores the previous version instantly.

Interview tip โ†’ Without versioning, deletion is permanent; ask whether it was enabled.

Copy link
Q79

Millions of small objects are being uploaded and S3 returns 503 Slow Down. What do you do?

Intermediate

Situation read โ†’ Per-prefix request rates (3,500 PUT and 5,500 GET per second) were exceeded.

What I'd do โ†’

  1. Spread keys across multiple prefixes
  2. Add retries with exponential backoff and jitter in the SDK
  3. Batch small objects into larger ones
  4. Request-rate scale-up is automatic over minutes, so ramp traffic gradually
  5. Check CloudWatch 5xxErrors request metrics

Why โ†’ S3 scales per prefix, so more prefixes means more throughput.

Interview tip โ†’ Backoff plus jitter is the universal AWS client answer.

Copy link
Q80

Large 50 GB files upload slowly from remote offices to S3. How do you speed it up?

Intermediate

Situation read โ†’ Use multipart parallel uploads and edge acceleration.

What I'd do โ†’

  1. Multipart is automatic in the CLI: tune aws configure set default.s3.multipart_chunksize 64MB and max_concurrent_requests 20
  2. Enable Transfer Acceleration: aws s3api put-bucket-accelerate-configuration --bucket b --accelerate-configuration Status=Enabled
  3. Use the accelerate endpoint b.s3-accelerate.amazonaws.com
  4. For bulk offline use Snowball

Why โ†’ Parallel parts use multiple connections, and acceleration shortens the public hop via edge locations.

Interview tip โ†’ Acceleration has per-GB cost; test with the speed comparison tool first.

Copy link
Q81

Design a cross-region DR strategy for a critical S3 bucket with a 15-minute RPO.

Advanced

Situation read โ†’ S3 Replication Time Control is the only option with an SLA on replication time.

What I'd do โ†’

  1. Enable versioning on both buckets
  2. Configure CRR with S3 RTC (99.99 percent of objects within 15 minutes)
  3. Replicate delete markers if desired and KMS-encrypted objects with the destination key
  4. Monitor ReplicationLatency and failed replication events
  5. Use Multi-Region Access Points for failover routing

Why โ†’ Normal replication is best-effort, RTC makes it contractual and monitorable.

Interview tip โ†’ Mention replication does not cover pre-existing objects without batch replication.

Copy link
Q82

An analytics team needs query access to 10 TB of logs in S3 without loading a warehouse. What do you propose?

Intermediate

Situation read โ†’ Athena over partitioned columnar data.

What I'd do โ†’

  1. Convert JSON logs to Parquet with Glue or Athena CTAS
  2. Partition by year/month/day and use Glue Data Catalog
  3. Use partition projection to avoid crawlers
  4. Query: SELECT count(*) FROM logs WHERE dt = '2026-11-01'
  5. Control cost with workgroup data-scanned limits

Why โ†’ Athena charges per TB scanned, so columnar format and partitions cut cost by 90 percent or more.

Interview tip โ†’ Always mention Parquet plus partitioning.

Copy link
Q83

Choose between RDS and running a database on EC2.

Beginner

Situation read โ†’ RDS manages backups, patching and failover; EC2 gives control at the cost of operations.

What I'd do โ†’

  1. Use RDS or Aurora unless you need unsupported extensions or OS access
  2. Enable Multi-AZ for production
  3. Automated backups with a 7 to 35 day retention
  4. Use parameter groups instead of editing files
  5. Go EC2 only with a specific need and a team to run it

Why โ†’ Operational toil is the real cost of self-managed databases.

Interview tip โ†’ RDS Custom exists for the in-between case.

Copy link
Q84

Your RDS primary failed over to the standby. What happened and what must the app do?

Intermediate

Situation read โ†’ In Multi-AZ, RDS flips the DNS endpoint CNAME to the standby, usually in 60 to 120 seconds.

What I'd do โ†’

  1. App must reconnect: use the endpoint DNS name, never an IP
  2. Set low DNS TTL awareness and connection retry
  3. Check events: aws rds describe-events --source-type db-instance --source-identifier mydb
  4. Test failover: aws rds reboot-db-instance --db-instance-identifier mydb --force-failover
  5. Use RDS Proxy to keep connections stable

Why โ†’ The standby is synchronously replicated, so no data is lost but connections drop.

Interview tip โ†’ Multi-AZ is for HA, not for read scaling (except the Multi-AZ cluster option).

Copy link
Q85

The database CPU is high due to read traffic. How do you scale reads?

Intermediate

Situation read โ†’ Offload reads to replicas and cache.

What I'd do โ†’

  1. Create read replicas: aws rds create-db-instance-read-replica --db-instance-identifier mydb-r1 --source-db-instance-identifier mydb
  2. Route read queries with a reader endpoint (Aurora) or app-level routing
  3. Add ElastiCache for hot keys
  4. Check slow queries with Performance Insights
  5. Watch ReplicaLag

Why โ†’ Replicas are asynchronous, so reads can be stale; choose consistency needs deliberately.

Interview tip โ†’ Fix bad queries before adding hardware.

Copy link
Q86

Plan a major-version RDS PostgreSQL upgrade with minimal downtime.

Advanced

Situation read โ†’ Blue/green deployments make a staged copy that you switch over.

What I'd do โ†’

  1. Create: aws rds create-blue-green-deployment --blue-green-deployment-name pg-upgrade --source <arn> --target-engine-version 17.2
  2. Test the green environment with real queries and extension checks
  3. Pause writes or accept a brief switchover, then switchover-blue-green-deployment
  4. Keep blue for rollback until verified
  5. Run ANALYZE after upgrade

Why โ†’ Switchover typically takes under a minute and avoids in-place upgrade risk.

Interview tip โ†’ Mention testing extensions and parameter compatibility first.

Copy link
Q87

Lambda functions exhaust database connections on RDS under load. Fix it.

Intermediate

Situation read โ†’ Each concurrent Lambda opens its own connection.

What I'd do โ†’

  1. Put RDS Proxy in front and connect to the proxy endpoint
  2. Create it with a Secrets Manager secret and the DB SG
  3. Reuse connections outside the handler
  4. Limit reserved concurrency
  5. Monitor DatabaseConnections

Why โ†’ The proxy pools and multiplexes connections so bursts do not hit max_connections.

Interview tip โ†’ Proxy needs IAM auth or secrets and runs in the VPC.

Copy link
Q88

DynamoDB throws ProvisionedThroughputExceededException for one user's activity. Why, and what's the fix?

Intermediate

Situation read โ†’ A hot partition: one partition key takes disproportionate traffic.

What I'd do โ†’

  1. Look at CloudWatch Contributor Insights for the hot key
  2. Redesign the key to spread load, such as adding a shard suffix user#17
  3. Switch to on-demand mode if the pattern is unpredictable
  4. Add DAX for read-heavy hotspots
  5. Add SDK backoff

Why โ†’ Throughput is divided among partitions, so even keys matter more than total capacity.

Interview tip โ†’ Adaptive capacity helps but does not fix a skewed design.

Copy link
Q89

When do you choose DynamoDB over RDS?

Intermediate

Situation read โ†’ Known access patterns, massive scale, single-digit-millisecond latency, little ops.

What I'd do โ†’

  1. Use DynamoDB for key-value or single-table designs like sessions, carts, IoT
  2. Use RDS or Aurora for relational joins, ad hoc queries and transactions across entities
  3. Model DynamoDB around queries, using GSIs for alternate access
  4. Prove the access patterns before committing

Why โ†’ DynamoDB is hard to retrofit with new query patterns, so choose it on certainty.

Interview tip โ†’ Say "access patterns first".

Copy link
Q90

Design a globally available DynamoDB application with active-active writes.

Advanced

Situation read โ†’ Global tables replicate across regions with last-writer-wins conflict resolution.

What I'd do โ†’

  1. Create the table with streams and add replicas: aws dynamodb update-table --table-name orders --replica-updates 'Create={RegionName=eu-west-1}'
  2. Route users with Route 53 latency routing
  3. Design writes to avoid conflicts, such as region-owned items
  4. Monitor ReplicationLatency
  5. Use multi-Region strong consistency option only when needed

Why โ†’ Replication is asynchronous and conflicts resolve by timestamp, so data modeling prevents lost updates.

Interview tip โ†’ Mention idempotent writes.

Copy link
Q91

You must restore a DynamoDB table to 14:30 yesterday. How?

Intermediate

Situation read โ†’ Point-in-time recovery restores to a new table.

What I'd do โ†’

  1. Make sure PITR is enabled: aws dynamodb update-continuous-backups --table-name t --point-in-time-recovery-specification PointInTimeRecoveryEnabled=true
  2. Restore: aws dynamodb restore-table-to-point-in-time --source-table-name t --target-table-name t-restore --restore-date-time 2026-11-08T14:30:00Z
  3. Copy indexes, TTL, alarms and IAM manually
  4. Swap application to the new table

Why โ†’ PITR keeps 35 days of continuous backups and restores never overwrite in place.

Interview tip โ†’ Remember PITR is off by default.

Copy link
Q92

The RDS storage is 95 percent full on a Friday. What is the safe response?

Intermediate

Situation read โ†’ Storage autoscaling or manual modify can extend online.

What I'd do โ†’

  1. Modify: aws rds modify-db-instance --db-instance-identifier mydb --allocated-storage 500 --apply-immediately
  2. Enable storage autoscaling with --max-allocated-storage 2000
  3. Find bloat or giant logs and purge
  4. Note the six-hour cooldown between modifications
  5. Alert on FreeStorageSpace at 20 percent

Why โ†’ Storage can grow online but never shrink, so size growth with intent.

Interview tip โ†’ Mention the cooldown trap.

Copy link
Q93

Aurora versus RDS PostgreSQL: how do you decide?

Advanced

Situation read โ†’ Aurora gives faster failover, shared storage and up to 15 replicas, at a higher price.

What I'd do โ†’

  1. Pick Aurora for heavy read scale, quick failover (about 30 seconds), serverless v2 elasticity or global database
  2. Pick RDS PostgreSQL for cost and plain engine behavior
  3. Compare IOPS charges against Aurora I/O-Optimized
  4. Benchmark with production-like load

Why โ†’ Aurora decouples compute and storage, replicas read the same volume with tiny lag.

Interview tip โ†’ Don't claim Aurora is always better; cost matters.

Copy link
Q94

An S3 bucket receiving PUTs must trigger processing for each file. What is the design?

Intermediate

Situation read โ†’ S3 event notifications to SQS or EventBridge, then workers.

What I'd do โ†’

  1. Configure notifications on s3:ObjectCreated:* to an SQS queue
  2. Lambda or ECS workers poll the queue
  3. Add a DLQ with maxReceiveCount 5
  4. Use EventBridge instead for multiple consumers and filtering
  5. Make processing idempotent since events are at-least-once

Why โ†’ A queue buffers bursts and decouples upload rate from processing rate.

Interview tip โ†’ S3 to Lambda directly is fine for small flows but lacks buffering.

Copy link
Q95

Share a private S3 object with an external customer for one hour. How?

Intermediate

Situation read โ†’ Use a presigned URL.

What I'd do โ†’

  1. Generate: aws s3 presign s3://bucket/report.pdf --expires-in 3600
  2. Sign with a role whose credentials outlive the URL (role session expiry caps URL life)
  3. For uploads use a presigned PUT or POST policy with size limits
  4. Log access with S3 server access logs or CloudTrail data events

Why โ†’ The URL carries the signer's permissions temporarily without making the object public.

Interview tip โ†’ URLs signed with temporary credentials die when those credentials expire.

Copy link
Q96

Design a backup strategy across accounts for RDS, EBS and DynamoDB with ransomware protection.

Advanced

Situation read โ†’ Centralized, immutable, cross-account backups.

What I'd do โ†’

  1. Use AWS Backup with a backup plan and tag-based selection
  2. Copy to a vault in a separate backup account and region
  3. Enable Backup Vault Lock in compliance mode for immutability
  4. Restrict vault access policy
  5. Run restore tests regularly

Why โ†’ An attacker with workload-account admin cannot delete locked copies in another account.

Interview tip โ†’ Untested backups are a hope, not a plan.

Copy link
Q97

The application writes and then immediately reads from S3 and sometimes gets stale data. Is that possible?

Intermediate

Situation read โ†’ S3 has been strongly consistent for reads after writes since December 2020.

What I'd do โ†’

  1. Check whether reads pass through CloudFront cache
  2. Check replication destinations, which are eventual
  3. Check app-level caching
  4. Verify with aws s3api head-object right after the PUT

Why โ†’ The staleness almost always comes from a layer above S3.

Interview tip โ†’ If someone says S3 is eventually consistent, correct them politely.

Copy link
Q98

How do you encrypt data at rest in S3 and who manages the keys?

Beginner

Situation read โ†’ SSE-S3 by default; SSE-KMS gives key-level audit and control.

What I'd do โ†’

  1. Default encryption SSE-S3 applies to new objects automatically
  2. For regulated data set SSE-KMS with a customer managed key
  3. Enable S3 Bucket Keys to cut KMS request cost
  4. Use aws s3api put-bucket-encryption
  5. Grant kms:Decrypt to consumers

Why โ†’ KMS adds an audit trail and revocable key access.

Interview tip โ†’ SSE-C and client-side encryption exist but add key handling burden.

Copy link
Q99

Plan a migration of a 5 TB on-prem Oracle database to AWS with minimal downtime.

Advanced

Situation read โ†’ DMS with ongoing replication after schema conversion.

What I'd do โ†’

  1. Assess with Schema Conversion Tool and decide target (RDS Oracle, or Aurora PostgreSQL if converting)
  2. Create the target, load schema, then start a DMS task with full load plus CDC
  3. Validate rows with DMS data validation
  4. Cut over: stop writes, wait for lag zero, repoint the app
  5. Keep reverse replication for rollback

Why โ†’ CDC keeps the target within seconds of the source so cutover is minutes.

Interview tip โ†’ Mention a network path (DX or VPN) sized for the initial load.

Copy link

Route 53, CloudFront and Messaging

๐ŸŽฅ Learn this hands-on with DevOps Shack โ†’ YouTube @devopsshack ยท Hindi @shackverse ยท Courses at devopsshack.com

Q100

You want users routed to the nearest healthy region. Which Route 53 policy do you use?

Beginner

Situation read โ†’ Latency routing with health checks.

What I'd do โ†’

  1. Create latency records for api.example.com in eu-west-1 and us-east-1
  2. Attach Route 53 health checks to each
  3. Use alias records to the regional ALBs with EvaluateTargetHealth true
  4. Test: dig api.example.com from different locations
  5. Keep TTL low, 60 seconds

Why โ†’ Latency routing picks the lowest-latency region, health checks remove failed ones.

Interview tip โ†’ Latency is measured to AWS regions, not to the user's exact location.

Copy link
Q101

Primary region fails; how do you fail over DNS in a controlled way?

Intermediate

Situation read โ†’ Failover routing with a primary and secondary record.

What I'd do โ†’

  1. Primary record with a health check on a deep endpoint /healthz
  2. Secondary record pointing to the DR region
  3. Alias with evaluate target health
  4. For explicit control use Application Recovery Controller routing controls
  5. Remember clients cache DNS beyond TTL

Why โ†’ Health-checked failover is automatic; ARC gives a manual, safe switch that avoids flapping.

Interview tip โ†’ DNS failover is never instant; mention TTL and resolver caching.

Copy link
Q102

What is the difference between a CNAME and an alias record in Route 53?

Beginner

Situation read โ†’ Alias is a Route 53 extension that works at the zone apex and is free for AWS targets.

What I'd do โ†’

  1. CNAME cannot exist at example.com apex
  2. Alias to ALB, CloudFront, S3 website, API Gateway, with no query charge
  3. Alias records resolve to A or AAAA, so health tracking is built in
  4. Create via aws route53 change-resource-record-sets

Why โ†’ Alias gives apex support and removes an extra DNS hop.

Interview tip โ†’ Use alias for AWS resources, CNAME for external ones.

Copy link
Q103

Roll out a new version to 5 percent of users using DNS. How?

Intermediate

Situation read โ†’ Weighted routing.

What I'd do โ†’

  1. Create two records with weights 95 and 5 and different SetIdentifier
  2. Attach health checks
  3. Increase weight over time
  4. Monitor errors per version
  5. Prefer ALB weighted target groups for finer control because DNS caching blurs percentages

Why โ†’ DNS weights are probabilities per resolver query, not per user.

Interview tip โ†’ Say DNS canaries are coarse; ALB or CloudFront continuous deployment is better.

Copy link
Q104

CloudFront serves stale content after you deployed a new JS bundle. How do you handle cache correctly?

Intermediate

Situation read โ†’ Hash filenames for assets and invalidate only the entry HTML.

What I'd do โ†’

  1. Build with content hashes like app.3f9a1c.js and long TTL Cache-Control: max-age=31536000, immutable
  2. Keep index.html at short TTL
  3. Invalidate: aws cloudfront create-invalidation --distribution-id E123 --paths /index.html
  4. Use a cache policy rather than legacy settings

Why โ†’ Versioned filenames avoid invalidations, which are slow and cost beyond the free quota.

Interview tip โ†’ Mention first 1,000 paths per month are free.

Copy link
Q105

CloudFront returns 403 from an S3 origin. List the checks.

Intermediate

Situation read โ†’ It's usually OAC or bucket policy, or a missing object.

What I'd do โ†’

  1. Verify the bucket policy allows cloudfront.amazonaws.com with AWS:SourceArn equal to the distribution ARN
  2. Check the origin uses OAC and the correct bucket regional domain
  3. Check the object key exists, since missing keys return 403 without s3:ListBucket
  4. Check SSE-KMS key policy allows CloudFront
  5. Inspect with curl -I https://d111.cloudfront.net/index.html

Why โ†’ S3 hides existence of keys from principals lacking list permission, producing 403 instead of 404.

Interview tip โ†’ KMS-encrypted origins need extra OAC key policy.

Copy link
Q106

Protect an origin so that only CloudFront can reach your ALB.

Advanced

Situation read โ†’ Use the managed prefix list and a secret header.

What I'd do โ†’

  1. In the ALB SG allow 443 from the com.amazonaws.global.cloudfront.origin-facing prefix list
  2. Have CloudFront add a custom header X-Origin-Verify: <secret>
  3. ALB listener rule forwards only when the header matches, else 403
  4. Rotate the secret with Secrets Manager
  5. Or use VPC origins for private ALBs

Why โ†’ The prefix list stops direct IP access, the header stops other CloudFront distributions.

Interview tip โ†’ VPC origins removes the public ALB entirely.

Copy link
Q107

Add WAF protection against SQL injection and bot floods for a public app.

Intermediate

Situation read โ†’ AWS WAF on CloudFront or ALB with managed rule groups and rate limits.

What I'd do โ†’

  1. Create a web ACL with AWS managed rules AWSManagedRulesCommonRuleSet and AWSManagedRulesSQLiRuleSet
  2. Add a rate-based rule such as 2,000 requests per 5 minutes per IP
  3. Start in Count mode, review logs, then Block
  4. Send logs to S3 or CloudWatch
  5. Add Shield Advanced for DDoS needs

Why โ†’ Count mode prevents false positives from blocking real customers on day one.

Interview tip โ†’ Mention WAF logging to inspect matches.

Copy link
Q108

A queue consumer crashes mid-message and the message is processed twice. Is that a bug?

Beginner

Situation read โ†’ SQS standard is at-least-once, so duplicates are expected.

What I'd do โ†’

  1. Make consumers idempotent using a dedupe key in DynamoDB with a conditional write
  2. Tune VisibilityTimeout above processing time
  3. Use FIFO with MessageDeduplicationId if ordering and dedupe are needed
  4. Configure a DLQ
  5. Delete only after success: aws sqs delete-message

Why โ†’ Visibility timeout hides the message during processing, crashes make it reappear.

Interview tip โ†’ Idempotency is the answer to every at-least-once system.

Copy link
Q109

Messages keep failing and blocking others in a queue. How do you isolate poison messages?

Intermediate

Situation read โ†’ Use a dead-letter queue with a redrive path.

What I'd do โ†’

  1. Set RedrivePolicy with maxReceiveCount 5 to a DLQ
  2. Alarm on ApproximateNumberOfMessagesVisible on the DLQ
  3. Inspect messages, fix the bug, then redrive: aws sqs start-message-move-task --source-arn <dlq-arn>
  4. Keep DLQ retention longer than main (14 days)

Why โ†’ DLQ keeps healthy flow moving and preserves bad messages for diagnosis.

Interview tip โ†’ Mention FIFO message group blocking.

Copy link
Q110

One event must fan out to email, an SQS worker and a Lambda. What do you use?

Intermediate

Situation read โ†’ SNS topic with multiple subscriptions.

What I'd do โ†’

  1. Create the topic and subscribe email, SQS queue and Lambda
  2. Allow SNS to send to the queue via the queue policy
  3. Add subscription filter policies by message attribute
  4. Enable raw message delivery to SQS
  5. Use FIFO topics if ordering matters

Why โ†’ Pub/sub decouples publisher from consumers, so adding one needs no publisher change.

Interview tip โ†’ Filter policies cut cost by delivering only relevant messages.

Copy link
Q111

Choose between SQS, SNS, EventBridge and Kinesis for an order platform.

Intermediate

Situation read โ†’ They suit different delivery shapes.

What I'd do โ†’

  1. SQS: buffering and work queues, one consumer group
  2. SNS: simple high-throughput fan-out
  3. EventBridge: content-based routing, schema registry, SaaS and cross-account events
  4. Kinesis or MSK: ordered high-volume streams with replay
  5. Combine, such as EventBridge to SQS for durable consumers

Why โ†’ Choose by routing needs and replay requirement.

Interview tip โ†’ Replay and ordering point to streams, not queues.

Copy link
Q112

You need a nightly job that runs at 02:00 UTC and triggers an ECS task. How?

Intermediate

Situation read โ†’ EventBridge Scheduler is the managed cron.

What I'd do โ†’

  1. Create the schedule: aws scheduler create-schedule --name nightly --schedule-expression "cron(0 2 * * ? *)" --target '{"Arn":"<cluster-arn>","RoleArn":"<role>","EcsParameters":{...}}' --flexible-time-window Mode=OFF
  2. Give the role ecs:RunTask and iam:PassRole
  3. Add retry and a DLQ
  4. Alarm on failure

Why โ†’ No server to maintain, and time zones and retries are supported.

Interview tip โ†’ Mention iam:PassRole as the usual gotcha.

Copy link
Q113

Design an event-driven order pipeline that is resilient to downstream outage.

Advanced

Situation read โ†’ Durable buffering between each stage.

What I'd do โ†’

  1. API Gateway to Lambda writes the order to DynamoDB and emits an event to EventBridge
  2. EventBridge rules route to SQS queues per consumer (billing, inventory, email)
  3. Consumers read with batch size and partial batch failure response
  4. DLQs and alarms on age of oldest message
  5. Use outbox pattern with DynamoDB Streams for exactly-recorded publishing

Why โ†’ Queues absorb outages, so a billing downtime delays but never loses orders.

Interview tip โ†’ Mention ApproximateAgeOfOldestMessage as the best queue health alarm.

Copy link
Q114

Lambda reading SQS processes the same failed batch repeatedly. How to fix partial failures?

Intermediate

Situation read โ†’ Without partial batch response, one bad record retries the whole batch.

What I'd do โ†’

  1. Enable ReportBatchItemFailures on the event source mapping
  2. Return {"batchItemFailures":[{"itemIdentifier":"<messageId>"}]}
  3. Set a DLQ on the queue
  4. Set visibility timeout at least 6 times function timeout
  5. Reduce batch size if poison messages are common

Why โ†’ Only failed records return to the queue.

Interview tip โ†’ AWS recommends 6x function timeout for visibility.

Copy link
Q115

How do you make a Route 53 private hosted zone resolve names inside two VPCs?

Beginner

Situation read โ†’ Associate the zone with each VPC.

What I'd do โ†’

  1. aws route53 associate-vpc-with-hosted-zone --hosted-zone-id Z123 --vpc VPCRegion=eu-west-1,VPCId=vpc-0abc
  2. For cross-account use create-vpc-association-authorization first
  3. Enable enableDnsSupport and enableDnsHostnames on the VPC
  4. Test with dig from an instance

Why โ†’ PHZ answers only for associated VPCs, so scope is controlled.

Interview tip โ†’ Mention split-horizon DNS using the same zone name public and private.

Copy link
Q116

Your website domain must serve both example.com and www.example.com over HTTPS via CloudFront. What do you configure?

Intermediate

Situation read โ†’ Both names as alternate domain names with a matching cert.

What I'd do โ†’

  1. Request ACM cert in us-east-1 for both names, validate by DNS
  2. Add CNAMEs in the distribution
  3. Route 53 alias A and AAAA records for both
  4. Redirect www to apex with a CloudFront Function
  5. Use TLS 1.2 minimum policy

Why โ†’ CloudFront can only use ACM certificates from us-east-1.

Interview tip โ†’ Don't forget AAAA records for IPv6.

Copy link
Q117

Reduce latency and origin load for a dynamic API globally.

Advanced

Situation read โ†’ Cache what is safe, and use CloudFront as a global network accelerator even for uncacheable calls.

What I'd do โ†’

  1. Define cache policies per path: short TTL for GETs, no cache for POST
  2. Add Origin Shield in the region closest to the origin
  3. Use persistent connections to origin and HTTP/3 to clients
  4. Compress with Brotli
  5. Consider Global Accelerator for non-HTTP or static IP needs

Why โ†’ Edge termination of TLS cuts handshake latency even without cache hits.

Interview tip โ†’ Cache key design is where most wins and bugs live.

Copy link
Q118

A signed-URL protected video is playable by anyone with the link. How do you restrict it more?

Intermediate

Situation read โ†’ Use CloudFront signed cookies or URLs with short expiry and IP or policy limits.

What I'd do โ†’

  1. Create a key group with public key, trusted key groups on the behavior
  2. Generate a signed URL with custom policy including expiry and IP range
  3. Keep expiry minutes for streaming sessions through cookies
  4. Add geo restriction if needed
  5. Rotate keys through a new key group

Why โ†’ Time-limited signatures minimize reuse of leaked links.

Interview tip โ†’ Use key groups, not the deprecated root account key pairs.

Copy link
Q119

An SNS to HTTP endpoint subscription does not get messages. What do you check?

Intermediate

Situation read โ†’ Confirmation or delivery failure.

What I'd do โ†’

  1. Check the subscription is confirmed (not PendingConfirmation)
  2. Endpoint must respond 2xx quickly and be reachable publicly over HTTPS
  3. Review delivery status logs in CloudWatch
  4. Set a redrive DLQ on the subscription
  5. Check filter policy not excluding the message

Why โ†’ SNS only retries according to a delivery policy then drops without a DLQ.

Interview tip โ†’ Subscription-level DLQ is essential.

Copy link
Q120

What is the purpose of Route 53 health checks and what can they monitor?

Beginner

Situation read โ†’ They probe endpoints and drive DNS failover.

What I'd do โ†’

  1. HTTP, HTTPS, TCP checks from global checkers
  2. Calculated health checks combining others
  3. CloudWatch alarm health checks for private resources
  4. Alarm via SNS on HealthCheckStatus

Why โ†’ They let DNS remove failed endpoints automatically.

Interview tip โ†’ Private endpoints need a CloudWatch alarm-based check.

Copy link
Q121

Design API ingress for 10,000 requests per second with throttling and auth.

Advanced

Situation read โ†’ API Gateway or ALB depending on features and cost.

What I'd do โ†’

  1. REST or HTTP API Gateway with Cognito or JWT authorizer, usage plans and throttling
  2. For high steady volume compare cost with ALB plus Lambda or ECS
  3. Add WAF
  4. Default quota is 10,000 rps per region; request increases early
  5. Add caching and per-client throttling keys

Why โ†’ API Gateway per-request pricing makes ALB cheaper at sustained high traffic.

Interview tip โ†’ Mention HTTP API is cheaper than REST API when features suffice.

Copy link
Q122

An EventBridge rule is not triggering a target. Quick checklist.

Intermediate

Situation read โ†’ Pattern mismatch or target permission.

What I'd do โ†’

  1. Check the event bus is the right one (default vs custom)
  2. Test the pattern with aws events test-event-pattern
  3. Check target resource policy or role
  4. View FailedInvocations and Invocations metrics
  5. Add a DLQ to the target

Why โ†’ Most issues are pattern typos or missing invoke permissions.

Interview tip โ†’ Use TestEventPattern before deploying.

Copy link
Q123

Build a DNS-based blue/green cutover for an internal service with rollback.

Intermediate

Situation read โ†’ Weighted alias records plus low TTL.

What I'd do โ†’

  1. Lower TTL to 30 seconds a day before
  2. Add green record weight 0, test via direct name
  3. Shift 10 percent, 50 percent, 100 percent
  4. Keep blue for rollback
  5. Restore TTL after

Why โ†’ Lowering TTL ahead of time is what makes rollback quick.

Interview tip โ†’ Plan TTL changes early.

Copy link
Q124

How do you stop a public SNS topic or SQS queue from accepting messages from anyone?

Beginner

Situation read โ†’ Resource policies must restrict principals.

What I'd do โ†’

  1. Review queue policy Principal and add aws:SourceArn conditions
  2. Remove "Principal":"*" unless conditioned
  3. Use IAM Access Analyzer to find external access
  4. Enable encryption with KMS

Why โ†’ Open resource policies are a common data leak vector.

Interview tip โ†’ Mention Access Analyzer for external findings.

Copy link

ECS, EKS, Lambda and ECR

๐ŸŽฅ Learn this hands-on with DevOps Shack โ†’ YouTube @devopsshack ยท Hindi @shackverse ยท Courses at devopsshack.com

Q125

ECS on Fargate or on EC2: how do you choose?

Beginner

Situation read โ†’ Fargate removes host management; EC2 gives control and cost optimization at scale.

What I'd do โ†’

  1. Choose Fargate for most services, bursty workloads and small teams
  2. Choose EC2 for GPUs, large steady fleets with Savings Plans, privileged containers or daemon sets
  3. Use capacity providers to mix both
  4. Compare per vCPU-hour cost

Why โ†’ Fargate trades roughly 20 to 30 percent premium for no patching.

Interview tip โ†’ Say "Fargate by default, EC2 when numbers justify".

Copy link
Q126

Deploy a containerized API on ECS behind an ALB. What are the building blocks?

Beginner

Situation read โ†’ Task definition, service, target group, ALB.

What I'd do โ†’

  1. Push the image to ECR
  2. Register the task definition with awsvpc network mode, CPU and memory, log driver awslogs, and task role
  3. Create a service with desired count 3 across subnets and attach it to the ALB target group (IP type)
  4. Configure health check path and deployment circuit breaker
  5. aws ecs update-service --cluster prod --service api --force-new-deployment

Why โ†’ The task role grants app permissions, the execution role lets ECS pull images and write logs.

Interview tip โ†’ Know task role versus execution role.

Copy link
Q127

An ECS service deployment is stuck, tasks start and stop repeatedly. How do you debug?

Intermediate

Situation read โ†’ The task fails health checks or crashes.

What I'd do โ†’

  1. aws ecs describe-services and read the events
  2. aws ecs describe-tasks --tasks <arn> for stoppedReason and exit code
  3. Check CloudWatch logs of the container
  4. Verify the health check path and grace period healthCheckGracePeriodSeconds
  5. Enable the deployment circuit breaker with rollback

Why โ†’ The stopped reason usually names OOM (exit 137) or image pull errors directly.

Interview tip โ†’ Exit code 137 equals OOM kill.

Copy link
Q128

Roll out a new ECS service version with canary and automatic rollback.

Intermediate

Situation read โ†’ Use CodeDeploy blue/green or ECS native blue/green.

What I'd do โ†’

  1. Two target groups on the ALB
  2. Deployment config CodeDeployDefault.ECSCanary10Percent5Minutes
  3. CloudWatch alarms on 5xx and latency attached to the deployment group
  4. Automatic rollback on alarm
  5. Test listener for pre-traffic validation hooks

Why โ†’ Alarms trigger automatic reversal without a human.

Interview tip โ†’ Mention ECS native blue/green as the newer path.

Copy link
Q129

EKS pods need access to S3 without node-level permissions. How?

Intermediate

Situation read โ†’ IAM roles for service accounts or EKS Pod Identity.

What I'd do โ†’

  1. With Pod Identity: install the agent add-on, then aws eks create-pod-identity-association --cluster-name prod --namespace app --service-account s3-reader --role-arn arn:aws:iam::111111111111:role/s3-reader
  2. Annotate nothing, pods use the SDK default chain
  3. Role trusts pods.eks.amazonaws.com
  4. Verify with aws sts get-caller-identity inside the pod

Why โ†’ Per-pod roles enforce least privilege instead of every pod inheriting the node role.

Interview tip โ†’ IRSA still works; Pod Identity is simpler across clusters.

Copy link
Q130

Upgrade an EKS cluster from 1.31 to 1.33 safely.

Intermediate

Situation read โ†’ Only one minor version at a time, control plane first.

What I'd do โ†’

  1. Check deprecated APIs with kubent or pluto
  2. Update add-ons compatibility
  3. Upgrade control plane: aws eks update-cluster-version --name prod --kubernetes-version 1.32
  4. Upgrade managed node groups with surge settings
  5. Repeat for 1.33
  6. Verify PDBs exist to avoid outages during drains

Why โ†’ Skipping versions is unsupported and API removals cause hard failures.

Interview tip โ†’ Mention the extended support cost for old versions.

Copy link
Q131

Design node scaling for EKS with mixed Spot and On-Demand and fast scale-up.

Advanced

Situation read โ†’ Karpenter replaces fixed node groups with just-in-time right-sized nodes.

What I'd do โ†’

  1. Install Karpenter with a NodePool allowing multiple instance families and spot plus on-demand capacity types
  2. Set disruption consolidation policy WhenEmptyOrUnderutilized
  3. Keep a small managed node group for system pods
  4. Use PDBs and topologySpreadConstraints
  5. Handle interruption via SQS queue integration

Why โ†’ Karpenter picks the cheapest fitting instance in seconds rather than scaling fixed groups.

Interview tip โ†’ Mention bin-packing and consolidation.

Copy link
Q132

An EKS pod is stuck in Pending with "0/3 nodes are available: Insufficient cpu". What do you do?

Intermediate

Situation read โ†’ Capacity or requests are too high.

What I'd do โ†’

  1. kubectl describe pod for the scheduler message
  2. kubectl top nodes and review requests versus usage
  3. Scale the node group or let the autoscaler add nodes
  4. Right-size over-large requests
  5. Check taints and affinity

Why โ†’ Scheduling uses requests, not actual usage.

Interview tip โ†’ Requests drive bin-packing and cost.

Copy link
Q133

Lambda function times out after 3 seconds calling an external API. What's wrong?

Beginner

Situation read โ†’ Default timeout is 3 seconds, or the function is in a VPC without egress.

What I'd do โ†’

  1. Increase timeout: aws lambda update-function-configuration --function-name f --timeout 30
  2. If VPC-attached, ensure NAT or endpoint access
  3. Check logs for the exact duration with REPORT lines
  4. Set client timeouts shorter than the function timeout

Why โ†’ VPC-attached Lambdas have no internet unless routed via NAT.

Interview tip โ†’ Most "mystery timeouts" are VPC egress.

Copy link
Q134

Lambda cold starts hurt latency for a user-facing API. Options?

Intermediate

Situation read โ†’ Reduce init time, or pre-warm capacity.

What I'd do โ†’

  1. Enable Provisioned Concurrency on an alias
  2. Or use SnapStart for Java, Python and .NET
  3. Shrink package, lazy load libraries, use ARM64
  4. Avoid VPC-ENI penalties (now small)
  5. Right-size memory since CPU scales with it

Why โ†’ Provisioned concurrency keeps environments initialized at a cost.

Interview tip โ†’ Memory tuning often cuts duration and cost together.

Copy link
Q135

Your Lambda scaled so much it overwhelmed a downstream database. How do you cap it?

Intermediate

Situation read โ†’ Reserved concurrency limits the function.

What I'd do โ†’

  1. aws lambda put-function-concurrency --function-name f --reserved-concurrent-executions 50
  2. Buffer with SQS and set event source MaximumConcurrency
  3. Add RDS Proxy
  4. Alarm on Throttles and ConcurrentExecutions

Why โ†’ Reserved concurrency is both a guarantee and a ceiling.

Interview tip โ†’ Account concurrency default is 1,000 per region.

Copy link
Q136

An ECR repo grows to 2 TB of images. How do you control it?

Intermediate

Situation read โ†’ Lifecycle policies expire old images.

What I'd do โ†’

  1. Create a lifecycle policy keeping the last 20 tagged release-* and expiring untagged after 7 days
  2. aws ecr put-lifecycle-policy --repository-name app --lifecycle-policy-text file://policy.json
  3. Use --image-tag-mutability IMMUTABLE for release tags
  4. Enable image scanning on push

Why โ†’ Storage is billed per GB-month, and old layers accumulate quietly.

Interview tip โ†’ Preview with the dry-run lifecycle preview.

Copy link
Q137

Multiple accounts must pull images from one central ECR. How?

Intermediate

Situation read โ†’ Repository policy plus replication if cross-region.

What I'd do โ†’

  1. Add a repository policy granting ecr:BatchGetImage, ecr:GetDownloadUrlForLayer to the account or org ID
  2. The pulling role also needs ecr:GetAuthorizationToken
  3. Use ECR replication rules for regional copies
  4. Use pull-through cache for public registries

Why โ†’ Centralizing images gives one scan and promotion point.

Interview tip โ†’ Pull-through cache avoids Docker Hub rate limits.

Copy link
Q138

Design a CI/CD supply chain for images: scan, sign, and enforce at deploy.

Advanced

Situation read โ†’ Security gates in the pipeline plus admission enforcement.

What I'd do โ†’

  1. Build with BuildKit, push to ECR with immutable digest
  2. Scan with ECR enhanced scanning (Inspector) and fail on Critical
  3. Sign with Cosign or AWS Signer
  4. Admission policy (Kyverno or Gatekeeper) verifies signatures and allows only the org ECR
  5. Deploy by digest not tag

Why โ†’ Digest pinning plus signature verification stops tag-swap attacks.

Interview tip โ†’ Mention SBOM generation.

Copy link
Q139

An ECS task cannot pull its image from ECR in a private subnet: "CannotPullContainerError". Why?

Intermediate

Situation read โ†’ No network path to ECR or missing execution role permission.

What I'd do โ†’

  1. Add interface endpoints ecr.api, ecr.dkr and an S3 gateway endpoint for layers
  2. Or provide NAT
  3. Execution role needs AmazonECSTaskExecutionRolePolicy
  4. Check SG allows 443 to the endpoints
  5. Retry the service

Why โ†’ Layers are stored in S3, which most people forget when building endpoints.

Interview tip โ†’ S3 gateway endpoint is part of the set.

Copy link
Q140

Choose between Lambda, Fargate and EKS for a new service.

Intermediate

Situation read โ†’ Based on runtime shape and team capability.

What I'd do โ†’

  1. Lambda: event-driven, spiky, short (under 15 minutes)
  2. Fargate: long-running containers without cluster operations
  3. EKS: need Kubernetes ecosystem, portability, complex scheduling
  4. Compare cost at expected steady load

Why โ†’ Operational overhead grows from Lambda to Fargate to EKS.

Interview tip โ†’ Do not choose EKS for resume value.

Copy link
Q141

Secure an EKS cluster's API endpoint and workloads.

Advanced

Situation read โ†’ Layered security from endpoint to pod.

What I'd do โ†’

  1. Make the API endpoint private or restrict public CIDRs: aws eks update-cluster-config --name prod --resources-vpc-config endpointPublicAccess=false,endpointPrivateAccess=true
  2. Use access entries instead of aws-auth ConfigMap
  3. Enforce Pod Security Standards restricted
  4. NetworkPolicies and Security Groups for pods
  5. Enable control plane logging and GuardDuty EKS protection

Why โ†’ API endpoint exposure is the highest-impact decision.

Interview tip โ†’ Access entries are the current auth method.

Copy link
Q142

An application on Lambda needs a secret. Should you put it in environment variables?

Intermediate

Situation read โ†’ Env vars are readable by anyone with lambda:GetFunctionConfiguration.

What I'd do โ†’

  1. Store in Secrets Manager or SSM Parameter Store SecureString
  2. Fetch at init and cache, or use the Parameters and Secrets Lambda extension
  3. Grant secretsmanager:GetSecretValue on that secret
  4. Use KMS CMK for extra control

Why โ†’ Central storage gives rotation and audit.

Interview tip โ†’ Extension caches calls and cuts cost.

Copy link
Q143

ECS tasks run out of memory only in production. How do you right-size?

Intermediate

Situation read โ†’ Container insights show actual usage.

What I'd do โ†’

  1. Enable Container Insights
  2. Check MemoryUtilized versus reserved
  3. Set a hard memory limit and soft memoryReservation
  4. Use load test to find p99 memory
  5. Alert on OOM exit 137

Why โ†’ Dev traffic rarely resembles production memory behavior.

Interview tip โ†’ Hard limit equals kill, soft limit equals scheduling hint.

Copy link
Q144

Run a multi-tenant SaaS on EKS with strong tenant isolation. How?

Advanced

Situation read โ†’ Isolation tiers: namespace, node, cluster.

What I'd do โ†’

  1. Namespaces with ResourceQuotas, NetworkPolicies, RBAC per tenant
  2. Dedicated nodes via taints for sensitive tenants
  3. Pod Identity roles per tenant
  4. Separate clusters or accounts for regulated tenants
  5. Observability per tenant labels

Why โ†’ Choose isolation by tenant risk and cost.

Interview tip โ†’ Mention noisy neighbor controls.

Copy link
Q145

Run a one-off migration container on ECS before each deploy. What pattern?

Intermediate

Situation read โ†’ Run a standalone task as a pipeline step.

What I'd do โ†’

  1. aws ecs run-task --cluster prod --task-definition migrate --launch-type FARGATE --network-configuration ...
  2. Wait: aws ecs wait tasks-stopped --cluster prod --tasks <arn>
  3. Check exit code via describe-tasks
  4. Fail the pipeline on non-zero
  5. Then deploy the service

Why โ†’ Separating migration from service start avoids race conditions among replicas.

Interview tip โ†’ Use backward-compatible migrations.

Copy link
Q146

How does an ECS task get AWS permissions at runtime?

Beginner

Situation read โ†’ Through its task role, via a credentials endpoint.

What I'd do โ†’

  1. Define taskRoleArn in the task definition
  2. ECS injects AWS_CONTAINER_CREDENTIALS_RELATIVE_URI
  3. SDK picks it up automatically
  4. Never share the instance role with containers

Why โ†’ Per-task roles give least privilege.

Interview tip โ†’ Differentiate task role and execution role.

Copy link
Q147

Lambda deployments should shift traffic gradually. What do you use?

Intermediate

Situation read โ†’ Aliases with weighted routing or CodeDeploy.

What I'd do โ†’

  1. Publish a version: aws lambda publish-version --function-name f
  2. Alias live weights 90/10
  3. Or SAM DeploymentPreference: Canary10Percent5Minutes with alarms
  4. Roll back by shifting alias

Why โ†’ Aliases decouple callers from versions.

Interview tip โ†’ Always call via alias.

Copy link
Q148

Containers on EKS should scale on SQS queue depth. How?

Intermediate

Situation read โ†’ KEDA scales pods on external metrics.

What I'd do โ†’

  1. Install KEDA
  2. Create a ScaledObject with an aws-sqs-queue trigger and queueLength 20
  3. Authenticate using Pod Identity
  4. Set min and max replicas
  5. Combine with Karpenter for nodes

Why โ†’ Queue depth reflects work to do better than CPU.

Interview tip โ†’ Scale-to-zero is possible.

Copy link
Q149

Plan a migration of 200 Docker Compose services to AWS. Where do you start?

Advanced

Situation read โ†’ Triage by complexity and make a landing pattern first.

What I'd do โ†’

  1. Classify stateless, stateful, and batch
  2. Build a standard ECS Fargate template (Terraform module)
  3. Migrate low-risk services first with weighted traffic
  4. Move data stores with DMS
  5. Automate observability and CI templates

Why โ†’ Golden path templates avoid 200 snowflakes.

Interview tip โ†’ Pilot first, then scale.

Copy link
Q150

An image push to ECR fails with "denied: Your authorization token has expired". What do you do?

Intermediate

Situation read โ†’ ECR tokens last 12 hours.

What I'd do โ†’

  1. Re-authenticate: aws ecr get-login-password --region eu-west-1 | docker login --username AWS --password-stdin 111111111111.dkr.ecr.eu-west-1.amazonaws.com
  2. In CI, run login each job
  3. Use credential helper docker-credential-ecr-login

Why โ†’ Tokens are short-lived by design.

Interview tip โ†’ Credential helper avoids manual login.

Copy link

Observability, Secrets, KMS and CloudFormation

๐ŸŽฅ Learn this hands-on with DevOps Shack โ†’ YouTube @devopsshack ยท Hindi @shackverse ยท Courses at devopsshack.com

Q151

You need to be paged when 5xx errors on the ALB exceed 2 percent for 5 minutes. How?

Beginner

Situation read โ†’ A CloudWatch alarm using metric math.

What I'd do โ†’

  1. Metric math: 100 * m1 / m2 with m1 HTTPCode_Target_5XX_Count and m2 RequestCount
  2. Alarm: 5-minute period, threshold 2, 1 of 1 or 2 of 3 datapoints
  3. Treat missing data as notBreaching
  4. Action to an SNS topic wired to PagerDuty or Chatbot

Why โ†’ Percentages beat raw counts, since traffic varies.

Interview tip โ†’ Mention treating missing data deliberately.

Copy link
Q152

How do you centralize application logs from many EC2 and ECS services?

Beginner

Situation read โ†’ CloudWatch Logs with agents or log drivers, then subscription filters.

What I'd do โ†’

  1. EC2 uses the CloudWatch agent with amazon-cloudwatch-agent-ctl -a fetch-config
  2. ECS uses the awslogs driver
  3. Set retention: aws logs put-retention-policy --log-group-name /app/api --retention-in-days 30
  4. Subscription filter to Kinesis Firehose to S3 for archive
  5. Query with Logs Insights

Why โ†’ Retention defaults to never expire, which is a silent cost.

Interview tip โ†’ Always set retention.

Copy link
Q153

CloudWatch costs exploded. Where do you look?

Intermediate

Situation read โ†’ Usually log ingestion and custom metrics.

What I'd do โ†’

  1. Cost Explorer by usage type DataProcessing-Bytes and MetricMonitorUsage
  2. Find noisy log groups with aws logs describe-log-groups sorted by storedBytes
  3. Reduce debug logging, set retention, use Infrequent Access log class
  4. High-cardinality custom metric dimensions are charged per series
  5. Use EMF carefully

Why โ†’ Ingestion costs around 50 cents per GB, so chatty debug logs dominate.

Interview tip โ†’ Cardinality kills metric budgets.

Copy link
Q154

Investigate a latency spike across microservices on AWS. What tools do you use?

Intermediate

Situation read โ†’ Follow a trace.

What I'd do โ†’

  1. Enable X-Ray or OpenTelemetry via ADOT
  2. Service map to find slow hops
  3. Logs Insights with request ID: fields @timestamp, @message | filter @message like /req-123/
  4. Correlate with ALB TargetResponseTime
  5. Check downstream throttling

Why โ†’ Traces show where time went; metrics show that it went.

Interview tip โ†’ Propagate a correlation ID everywhere.

Copy link
Q155

An auditor asks for proof of every configuration change to security groups for 12 months. What do you provide?

Intermediate

Situation read โ†’ AWS Config timeline plus CloudTrail.

What I'd do โ†’

  1. Config records configuration items for AWS::EC2::SecurityGroup
  2. Retrieve history: aws configservice get-resource-config-history --resource-type AWS::EC2::SecurityGroup --resource-id sg-0abc
  3. CloudTrail shows who made the call
  4. Retain in S3 with lifecycle for 12 months

Why โ†’ Config shows what changed, CloudTrail shows who.

Interview tip โ†’ Know the split.

Copy link
Q156

Auto-remediate any security group opened to 0.0.0.0/0 on port 22.

Advanced

Situation read โ†’ Config rule plus SSM Automation remediation.

What I'd do โ†’

  1. Enable managed rule restricted-ssh
  2. Attach remediation AWS-DisableIncomingSSHOnPort22 or custom runbook
  3. Set automatic remediation with 3 retries
  4. Notify through EventBridge to Slack
  5. Exempt tagged bastion exceptions

Why โ†’ Closing the hole in minutes beats ticket queues.

Interview tip โ†’ Include exception handling.

Copy link
Q157

Where should application database passwords live and how do they rotate?

Intermediate

Situation read โ†’ Secrets Manager with managed rotation.

What I'd do โ†’

  1. Create a secret: aws secretsmanager create-secret --name prod/db --secret-string file://creds.json
  2. Enable rotation: aws secretsmanager rotate-secret --secret-id prod/db --rotation-rules AutomaticallyAfterDays=30
  3. Use the multi-user rotation strategy for zero downtime
  4. App reads at runtime, refreshes on auth failure

Why โ†’ Rotation without redeploy removes the temptation to never rotate.

Interview tip โ†’ Aurora and RDS have managed rotation without custom Lambda.

Copy link
Q158

Secrets Manager or SSM Parameter Store: when to use which?

Intermediate

Situation read โ†’ Secrets Manager rotates and costs per secret; Parameter Store is cheaper for config.

What I'd do โ†’

  1. Parameter Store standard parameters are free, SecureString uses KMS
  2. Secrets Manager costs about $0.40 per secret per month plus API calls
  3. Use Secrets Manager for DB credentials and keys needing rotation or cross-region replication
  4. Use Parameter Store for flags and non-rotated config

Why โ†’ Match cost to need.

Interview tip โ†’ Cross-account sharing is simpler with Secrets Manager resource policies.

Copy link
Q159

Design KMS key strategy for a multi-account platform.

Advanced

Situation read โ†’ Keys per data domain with tight key policies.

What I'd do โ†’

  1. Customer managed keys per account and environment, aliased alias/app-prod
  2. Key policy delegates to IAM and lists admins separately from users
  3. Cross-account grants via key policy plus IAM
  4. Annual rotation enabled: aws kms enable-key-rotation
  5. Multi-Region keys for DR

Why โ†’ Separate admin and usage permissions so key admins cannot read data.

Interview tip โ†’ Mention deletion waiting period 7 to 30 days.

Copy link
Q160

An engineer scheduled a KMS key for deletion by mistake. What do you do?

Intermediate

Situation read โ†’ There's a waiting period; cancel it.

What I'd do โ†’

  1. aws kms cancel-key-deletion --key-id <key>
  2. Then aws kms enable-key --key-id <key>
  3. Alarm on ScheduleKeyDeletion events through EventBridge
  4. Restrict kms:ScheduleKeyDeletion with SCP
  5. Audit what the key encrypts

Why โ†’ Deleting a key makes all its data unrecoverable.

Interview tip โ†’ Disable first, delete later.

Copy link
Q161

Write a CloudFormation template that creates an S3 bucket with encryption and block public access.

Beginner

Situation read โ†’ Declarative resource with properties.

What I'd do โ†’

  1. Define AWS::S3::Bucket with BucketEncryption SSE and PublicAccessBlockConfiguration all true
  2. Add DeletionPolicy: Retain for data
  3. Validate: aws cloudformation validate-template --template-body file://t.yaml
  4. Deploy: aws cloudformation deploy --template-file t.yaml --stack-name app-bucket

Why โ†’ Defaults in code remove manual drift.

Interview tip โ†’ Retain policy protects data on stack deletion.

Copy link
Q162

A CloudFormation stack is stuck in UPDATE_ROLLBACK_FAILED. What now?

Intermediate

Situation read โ†’ A resource cannot return to prior state.

What I'd do โ†’

  1. Read events: aws cloudformation describe-stack-events --stack-name s
  2. Fix the blocking cause, e.g. manually deleted resource
  3. aws cloudformation continue-update-rollback --stack-name s --resources-to-skip LogicalId
  4. Then redeploy

Why โ†’ Skipping gets the stack back to a clean state.

Interview tip โ†’ Avoid manual console changes.

Copy link
Q163

Detect and handle drift between deployed resources and CloudFormation.

Intermediate

Situation read โ†’ Drift detection compares live to template.

What I'd do โ†’

  1. aws cloudformation detect-stack-drift --stack-name s
  2. describe-stack-resource-drifts for details
  3. Revert in the template or update the stack to correct
  4. Schedule regular detection
  5. Restrict console write access to reduce drift

Why โ†’ Drift defeats the repeatability of IaC.

Interview tip โ†’ Prevention with permissions beats detection.

Copy link
Q164

Roll out a CloudFormation change to 80 accounts safely.

Advanced

Situation read โ†’ StackSets with staged rollout.

What I'd do โ†’

  1. Use service-managed StackSets with org targets
  2. Operation preferences: max concurrent 10 percent, failure tolerance 1 account
  3. Deploy to canary OU first
  4. Region order sequence
  5. Monitor describe-stack-set-operation

Why โ†’ Failure tolerance stops a bad change early.

Interview tip โ†’ Know RegionConcurrencyType.

Copy link
Q165

Stack deletion fails because a bucket is not empty. How do you handle it?

Intermediate

Situation read โ†’ CloudFormation will not delete non-empty buckets.

What I'd do โ†’

  1. Empty: aws s3 rm s3://b --recursive, versioned buckets need s3api delete-objects for versions
  2. Retry delete
  3. Or use a custom resource that empties on delete
  4. Use Retain for important buckets

Why โ†’ Safety prevents accidental data loss.

Interview tip โ†’ Versioned buckets also need markers removed.

Copy link
Q166

You need change previews before applying an infrastructure change.

Intermediate

Situation read โ†’ Change sets.

What I'd do โ†’

  1. aws cloudformation create-change-set --stack-name s --change-set-name c1 --template-body file://t.yaml
  2. describe-change-set to see replacements
  3. Look for Replacement: True on stateful resources
  4. execute-change-set after review

Why โ†’ Replacement of a database is a data-loss event.

Interview tip โ†’ Use stack policies for protected resources.

Copy link
Q167

Implement CloudTrail for tamper-proof audit logs across an organization.

Advanced

Situation read โ†’ Org trail into a locked log archive.

What I'd do โ†’

  1. Create an organization trail with log file validation
  2. Deliver to S3 in the log-archive account with bucket policy and Object Lock
  3. Encrypt with KMS
  4. Send to CloudWatch Logs for alerts
  5. Validate: aws cloudtrail validate-logs --trail-arn ... --start-time ...

Why โ†’ Log file validation produces digests that expose tampering.

Interview tip โ†’ Add CloudTrail Lake for query.

Copy link
Q168

Alert on any root account usage.

Intermediate

Situation read โ†’ Event-based alerting.

What I'd do โ†’

  1. EventBridge rule on CloudTrail event with userIdentity.type equal to Root
  2. Route to SNS and pager
  3. Also detect via Config and Security Hub
  4. Enforce with SCP denying root actions in member accounts

Why โ†’ Root should be almost never used.

Interview tip โ†’ Centralized root management exists in Organizations.

Copy link
Q169

Build a dashboard and SLO alarm for an API.

Intermediate

Situation read โ†’ Golden signals.

What I'd do โ†’

  1. Metrics: latency p99, errors, traffic, saturation
  2. Dashboards via CloudFormation
  3. Composite alarms to cut noise
  4. Anomaly detection alarm for traffic
  5. Error budget burn rate alarms

Why โ†’ Composite alarms reduce pager fatigue.

Interview tip โ†’ Alert on symptoms, not causes.

Copy link
Q170

What does GuardDuty do and how do you enable it org-wide?

Beginner

Situation read โ†’ Threat detection from logs.

What I'd do โ†’

  1. Delegate an admin account
  2. aws guardduty create-detector --enable
  3. Auto-enable for new org accounts
  4. Findings to Security Hub and EventBridge
  5. Enable EKS, S3, Malware Protection plans

Why โ†’ No agents required.

Interview tip โ†’ Needs response runbooks, not just enabling.

Copy link
Q171

Respond to a GuardDuty finding: UnauthorizedAccess:IAMUser/InstanceCredentialExfiltration.

Advanced

Situation read โ†’ Instance role credentials used from outside AWS.

What I'd do โ†’

  1. Revoke sessions: attach AWSRevokeOlderSessions style deny with aws:TokenIssueTime condition
  2. Isolate instance with a quarantine SG
  3. Snapshot disk and memory for forensics
  4. Review CloudTrail for actions
  5. Enforce IMDSv2 and rotate secrets

Why โ†’ Revoking sessions invalidates stolen tokens.

Interview tip โ†’ Isolate before terminate.

Copy link
Q172

Make secrets available to ECS tasks without putting them in the task definition in plaintext.

Intermediate

Situation read โ†’ Reference secrets by ARN.

What I'd do โ†’

  1. In container definition use secrets: [{name: DB_PASS, valueFrom: <secret-arn>}]
  2. Execution role needs secretsmanager:GetSecretValue and kms:Decrypt
  3. Value is injected at start
  4. Restart tasks after rotation

Why โ†’ Plain env vars appear in console.

Interview tip โ†’ Injection happens only at task start.

Copy link
Q173

How do you enforce that every CloudFormation or Terraform change is reviewed for security before deploy?

Intermediate

Situation read โ†’ Policy as code in CI.

What I'd do โ†’

  1. Run cfn-guard validate or checkov on templates in pull requests
  2. Fail on high severity
  3. Require approval in the pipeline
  4. Use SCP as the backstop
  5. Report in Security Hub

Why โ†’ Shifting left is cheaper than detecting later.

Interview tip โ†’ Policies in version control are auditable.

Copy link

Cost Optimization and Disaster Recovery

๐ŸŽฅ Learn this hands-on with DevOps Shack โ†’ YouTube @devopsshack ยท Hindi @shackverse ยท Courses at devopsshack.com

Q174

Your AWS bill jumped 40 percent this month. How do you find the cause?

Beginner

Situation read โ†’ Start with Cost Explorer grouped by service, then account, then usage type.

What I'd do โ†’

  1. Cost Explorer daily view grouped by Service to find the day it jumped
  2. Drill by Usage Type and Linked Account
  3. Filter by tag to find the team
  4. Check Cost Anomaly Detection alerts
  5. Cross-check CloudTrail for the launch event

Why โ†’ Daily granularity points to a specific change.

Interview tip โ†’ Set budgets with alerts so you hear first.

Copy link
Q175

Set up budgets so no one is surprised by spend.

Beginner

Situation read โ†’ AWS Budgets with alerts and optional actions.

What I'd do โ†’

  1. aws budgets create-budget for monthly cost with 80 percent and 100 percent thresholds
  2. Notify SNS and email
  3. Forecast alerts
  4. Budget actions can attach a deny SCP or stop instances in dev
  5. Cost Anomaly Detection monitors per service

Why โ†’ Forecast alerts warn before the money is spent.

Interview tip โ†’ Use per-account budgets.

Copy link
Q176

Dev environments run 24/7 but are used 9 to 6 on weekdays. How do you cut cost?

Intermediate

Situation read โ†’ Schedule them off.

What I'd do โ†’

  1. Instance Scheduler on AWS or EventBridge Scheduler calling SSM AWS-StopEC2Instance
  2. Scale ASGs to zero at night
  3. Stop RDS (auto-restarts after 7 days) or use Aurora Serverless v2 min capacity
  4. Tag schedule=office-hours
  5. Report savings

Why โ†’ Running 50 hours instead of 168 saves about 70 percent.

Interview tip โ†’ Mention RDS 7-day restart.

Copy link
Q177

Find and remove idle and orphaned resources.

Intermediate

Situation read โ†’ Unattached volumes, idle load balancers, old snapshots, unused EIPs.

What I'd do โ†’

  1. aws ec2 describe-volumes --filters Name=status,Values=available
  2. Unused ELBs with zero requests via CloudWatch
  3. Trusted Advisor and Compute Optimizer idle findings
  4. Snapshots without AMIs
  5. Review NAT gateways with no traffic

Why โ†’ Orphans pile up after teardown with no owner.

Interview tip โ†’ Tag owner on everything.

Copy link
Q178

Reduce data transfer cost in a media-heavy architecture.

Advanced

Situation read โ†’ Data egress usually tops the bill.

What I'd do โ†’

  1. Serve through CloudFront, cheaper per GB than S3 direct egress and with a free tier
  2. Use CloudFront committed-use savings bundle
  3. Compress
  4. Keep inter-AZ traffic low
  5. Use endpoints to avoid NAT per-GB charges
  6. Consider S3 Intelligent-Tiering only for storage, not transfer

Why โ†’ Egress tiers favour CDNs at volume.

Interview tip โ†’ Always ask where the bytes flow.

Copy link
Q179

Choose S3 storage classes for data accessed unpredictably.

Intermediate

Situation read โ†’ Intelligent-Tiering.

What I'd do โ†’

  1. Move objects with lifecycle to INTELLIGENT_TIERING
  2. Frequent, Infrequent, Archive Instant tiers automatically
  3. Optional archive tiers
  4. No retrieval charges
  5. Small objects under 128 KB are not tiered

Why โ†’ It removes guesswork for unknown patterns.

Interview tip โ†’ Monitoring fee per object applies.

Copy link
Q180

Define RPO and RTO and map them to AWS DR strategies.

Beginner

Situation read โ†’ RPO is acceptable data loss; RTO is acceptable downtime.

What I'd do โ†’

  1. Backup and restore: hours RTO, cheapest
  2. Pilot light: core data replicated, compute off
  3. Warm standby: scaled-down full stack running
  4. Multi-site active-active: near-zero RTO and RPO
  5. Choose per workload criticality

Why โ†’ Cost rises as targets shrink.

Interview tip โ†’ State both numbers when asked.

Copy link
Q181

Design warm standby DR for a web app and database in another region.

Advanced

Situation read โ†’ Aurora Global Database plus scaled-down stack.

What I'd do โ†’

  1. Aurora Global Database replica in the DR region, lag usually under a second
  2. Minimal ASG or ECS service running
  3. S3 CRR and replicated secrets and ECR
  4. Route 53 failover with ARC
  5. Promote: aws rds failover-global-cluster --global-cluster-identifier g --target-db-cluster-identifier dr-cluster
  6. Scale up and cut DNS

Why โ†’ Warm standby shortens recovery to minutes.

Interview tip โ†’ Test it twice a year.

Copy link
Q182

Your DR region lacks capacity when you fail over. How do you prevent that?

Advanced

Situation read โ†’ Capacity is not guaranteed in a regional event.

What I'd do โ†’

  1. Pre-provision critical capacity or buy On-Demand Capacity Reservations
  2. Keep warm standby at meaningful size
  3. Avoid relying on control plane at failure time
  4. Increase service quotas in the DR region
  5. Run failover drills

Why โ†’ Many teams discover quota limits mid-incident.

Interview tip โ†’ Static stability.

Copy link
Q183

Recover an accidentally deleted EBS volume or EC2 instance.

Intermediate

Situation read โ†’ Needs prior snapshots or AMI.

What I'd do โ†’

  1. Use Data Lifecycle Manager or AWS Backup schedule
  2. Restore a volume: aws ec2 create-volume --snapshot-id snap-0abc --availability-zone eu-west-1a
  3. Recycle Bin for snapshots and AMIs retention rules
  4. Attach and mount
  5. Verify

Why โ†’ Recycle Bin protects against deletion mistakes.

Interview tip โ†’ Enable it for AMIs and snapshots.

Copy link
Q184

A region-wide outage hits us-east-1. Which dependencies could still break a multi-region app?

Intermediate

Situation read โ†’ Some global control planes live in us-east-1.

What I'd do โ†’

  1. IAM and Route 53 control planes are in us-east-1; data planes remain available
  2. Pre-create resources, avoid creating new IAM or DNS changes during failover
  3. ACM certificates for CloudFront
  4. Cross-region replicated secrets and images
  5. Use ARC data plane routing controls

Why โ†’ Static stability means failover requires no control plane calls.

Interview tip โ†’ Mention the Dec 2021 and Oct 2025 style events.

Copy link
Q185

Run a game day to validate your DR plan.

Advanced

Situation read โ†’ Practice with real failures.

What I'd do โ†’

  1. Define steady state and hypotheses
  2. Use AWS Fault Injection Service to stop instances or block AZ network
  3. Execute failover runbook, time RTO
  4. Verify data integrity
  5. Record gaps and fix

Why โ†’ Only drills reveal hidden dependencies.

Interview tip โ†’ Run them in prod-like environments with guardrails.

Copy link
Q186

Use Savings Plans and Spot together without overcommitting.

Intermediate

Situation read โ†’ Layer purchases by predictability.

What I'd do โ†’

  1. Cover baseline with Savings Plans
  2. Cover variable with On-Demand
  3. Cover fault-tolerant with Spot
  4. Track coverage and utilization
  5. Review monthly

Why โ†’ Utilization below 95 percent signals overcommit.

Interview tip โ†’ Know coverage versus utilization.

Copy link
Q187

Build a FinOps process across 100 accounts.

Advanced

Situation read โ†’ Visibility, accountability, optimization.

What I'd do โ†’

  1. CUR delivered to S3 and queried with Athena or QuickSight
  2. Mandatory tags through tag policies
  3. Showback dashboards per team
  4. Monthly review of Compute Optimizer and idle findings
  5. Central commitment management in the payer account

Why โ†’ Teams change behavior when they see their own costs.

Interview tip โ†’ Mention unit costs like cost per request.

Copy link
Q188

What is the AWS Free Tier trap for new accounts?

Beginner

Situation read โ†’ Free tier has limits and expiry.

What I'd do โ†’

  1. 12-month offers expire
  2. Set a zero-spend budget
  3. Delete resources when done
  4. Check Billing dashboard Free Tier usage
  5. Avoid leaving NAT gateways or Elastic IPs

Why โ†’ NAT gateways and public IPv4 incur charges immediately.

Interview tip โ†’ Beginners should set budgets first.

Copy link
Q189

Reduce RDS cost without hurting performance.

Intermediate

Situation read โ†’ Right-size and commitment.

What I'd do โ†’

  1. Check CPU and memory via Performance Insights
  2. Move to Graviton instances (db.r7g)
  3. Use gp3 storage
  4. Buy RDS Reserved Instances
  5. Drop unused read replicas and old snapshots

Why โ†’ Graviton gives better price performance.

Interview tip โ†’ Reserved Instances still matter for RDS.

Copy link
Q190

Choose between Multi-AZ and Multi-Region for a database.

Intermediate

Situation read โ†’ They solve different failures.

What I'd do โ†’

  1. Multi-AZ protects against instance and AZ failure with automatic failover
  2. Multi-Region protects against regional disasters with manual or orchestrated failover
  3. Add cross-region read replica or global database
  4. Combine both for critical systems
  5. Cost doubles roughly per region

Why โ†’ Match scope to the threat.

Interview tip โ†’ Multi-AZ is not a backup.

Copy link
Q191

Design cross-account disaster recovery for ransomware where the attacker has prod admin.

Advanced

Situation read โ†’ Assume prod account compromise.

What I'd do โ†’

  1. Isolated recovery account with immutable vaults
  2. Backup Vault Lock compliance mode
  3. Logically air-gapped vault
  4. Separate identity path and break-glass
  5. Rehearse clean-room restore

Why โ†’ Attackers cannot delete what they cannot reach.

Interview tip โ†’ Compliance mode cannot be shortened even by root.

Copy link
Q192

Estimate the cost of a new architecture before building it.

Intermediate

Situation read โ†’ AWS Pricing Calculator plus assumptions.

What I'd do โ†’

  1. List components and quantities
  2. Use the calculator and export
  3. Add data transfer and logging
  4. Add 20 percent margin
  5. Compare against measured pilot

Why โ†’ Hidden costs are NAT, logs, and cross-AZ.

Interview tip โ†’ Validate with a pilot.

Copy link
Q193

Switch workloads to Graviton. What is the migration path?

Intermediate

Situation read โ†’ Check architecture compatibility.

What I'd do โ†’

  1. Rebuild images multi-arch with docker buildx build --platform linux/amd64,linux/arm64
  2. Test in staging on m7g
  3. Update AMIs
  4. Canary then roll
  5. Measure price-performance

Why โ†’ ARM gives lower cost per unit work.

Interview tip โ†’ Native dependencies are the trap.

Copy link
Q194

Meet a 4-hour RTO with low cost for a mid-tier internal app.

Intermediate

Situation read โ†’ Pilot light or backup restore.

What I'd do โ†’

  1. IaC for full stack in the DR region
  2. Cross-region snapshots through AWS Backup
  3. Runbook to deploy and restore
  4. Time a restore test
  5. Document DNS cutover

Why โ†’ IaC makes rebuild minutes not days.

Interview tip โ†’ Prove it with a timed test.

Copy link
Q195

What backup would you set for an EC2 fleet and how do you verify it?

Beginner

Situation read โ†’ Centralized backup with tests.

What I'd do โ†’

  1. AWS Backup plan with daily rule, 35-day retention, tag selection
  2. Copy to another region
  3. aws backup start-restore-job in a test
  4. Verify application boots
  5. Alarm on failed jobs

Why โ†’ Restore tests find silent failures.

Interview tip โ†’ Backups need alarms.

Copy link
Q196

Optimize S3 costs for 2 PB of logs mostly never read.

Intermediate

Situation read โ†’ Archive tiers and compression.

What I'd do โ†’

  1. Lifecycle to Glacier Instant, Flexible, Deep Archive
  2. Compress and convert to Parquet
  3. Reduce small objects
  4. Set expiration
  5. Use S3 Storage Lens

Why โ†’ Deep Archive costs about $1 per TB per month.

Interview tip โ†’ Retrieval times and fees matter.

Copy link
Q197

Plan a landing zone from scratch for a startup growing to 50 engineers.

Advanced

Situation read โ†’ Start simple with a scalable skeleton.

What I'd do โ†’

  1. Create Organizations with Security, Infra, Workloads OUs
  2. Control Tower with guardrails
  3. Identity Center with an IdP
  4. Network account with Transit Gateway later
  5. Baseline CloudTrail, Config, GuardDuty
  6. Account vending through IaC

Why โ†’ Retrofitting accounts later costs far more.

Interview tip โ†’ Start with accounts per environment.

Copy link
Q198

The CFO wants to know unit cost per customer. How do you measure?

Intermediate

Situation read โ†’ Tag by tenant or allocate shared costs.

What I'd do โ†’

  1. Tag resources tenant where possible
  2. Split Cost Allocation Data for EKS and ECS
  3. Use CUR and Athena
  4. Allocate shared by usage metrics
  5. Report cost per active customer

Why โ†’ Unit economics guides pricing.

Interview tip โ†’ Split cost allocation covers containers.

Copy link
Q199

Leadership wants to leave one cloud region for a second one for compliance with data residency. How do you plan the multi-region data layer?

Advanced

Situation read โ†’ Data residency means some data must never leave its region, so replication design is a legal decision before a technical one.

What I'd do โ†’

  1. Classify data by residency rule and tag it
  2. Keep regulated stores single-region with in-region Multi-AZ and in-region backups only
  3. Replicate only non-regulated or anonymized data across regions
  4. Enforce with SCP region deny, S3 replication rules scoped by tag and KMS keys that are single-region
  5. Document and test with a Config rule that flags cross-region replication on tagged resources

Why โ†’ A single misconfigured replication rule can violate residency, so enforcement must be automated, not procedural.

Interview tip โ†’ Use single-Region KMS keys for regulated data so ciphertext cannot be decrypted elsewhere.

Copy link
Q200

What does the AWS shared responsibility model mean in practice for an EC2 web server?

Beginner

Situation read โ†’ AWS secures the cloud itself; you secure everything you put in it.

What I'd do โ†’

  1. AWS: hardware, hypervisor, facilities, managed-service internals
  2. You: guest OS patching, security groups, IAM, application code, data encryption choices
  3. For RDS the line moves up: AWS patches the engine, you own parameters, access and data
  4. Document the split per service in your security review

Why โ†’ The line moves up the stack as you adopt more managed services.

Interview tip โ†’ Give one EC2 and one RDS example to show you understand the shift.

Copy link
Feedback