System DesignDevOpsCloud

AWS Cloud Fundamentals for DevOps Engineers

· Pavan Y N · aws, cloud, devops, architecture

Amazon Web Services (AWS) is a large cloud platform with services for compute, storage, networking, databases, security, and machine learning, delivered from data centers around the world. For DevOps engineers, the useful skill is knowing a handful of core services well: identity, virtual servers, object storage, networking, and load balancing, and how they fail. EduGeek explains how those services fit together, which defaults have changed in recent years, and which older habits to drop. The CLI commands, policies, and Terraform in this guide were checked against a local AWS API emulator, the AWS provider 6.x schema, and the AWS documentation as of October 2026; none of them were run against a real account.

# AWS global infrastructure

## Regions, Availability Zones, and edge locations

AWS describes its footprint on its global infrastructure page as 39 geographic Regions and 124 Availability Zones, with plans for more.

  • →Regions are separate geographic areas, each designed to be isolated from the others. Resources are tied to a Region, and AWS does not automatically replicate them across Regions. Choose a Region for latency to users, legal and compliance requirements, service availability, and price.
  • →Availability Zones (AZs) are multiple isolated locations within a Region, each with its own infrastructure and connected to the others with low-latency links. Every Region has at least three. Running across AZs protects an application from the failure of a single location.
  • →Edge locations serve content for Amazon CloudFront. AWS lists more than 750 CloudFront points of presence and 15 regional edge caches.
  • →Local Zones, Wavelength Zones, and Outposts extend a Region closer to users, to 5G networks, or into your own data center.

An AZ name such as us-east-1a is a Region code plus a letter, and the mapping from name to physical location differs between accounts. An AZ ID such as use1-az1 is the same physical location for every account, so use AZ IDs when two accounts must agree on a zone, for example when sharing subnets.

# Core AWS services

## 1. Identity and Access Management (IAM)

Concept: IAM controls who can access AWS resources and what they can do.

Key components:

  • →Users are individual identities with long-term credentials.
  • →Groups are collections of users.
  • →Roles are identities that provide temporary credentials to people, services, and workloads.
  • →Policies are JSON documents that define permissions.

Best practices from the current IAM documentation:

  • →Require human users to use federation with an identity provider and temporary credentials. AWS recommends IAM Identity Center for centralized access to accounts.
  • →Require workloads to use temporary credentials from IAM roles instead of long-term access keys. Workloads outside AWS can use options such as IAM Roles Anywhere or AssumeRoleWithWebIdentity.
  • →Require multi-factor authentication (MFA) for root and IAM users, and prefer phishing-resistant methods such as passkeys and security keys.
  • →Where long-term access keys are unavoidable, update them when needed (for example when an employee leaves) and use last-used information to retire them safely.
  • →Protect the root user credentials and avoid routine use of root.
  • →Apply least-privilege permissions, start from AWS managed policies and narrow them, and use IAM Access Analyzer to generate and validate policies.
  • →Use conditions, permissions boundaries, and AWS Organizations service control policies (SCPs) and resource control policies (RCPs) as guardrails across accounts.

Example IAM policy:

code
{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Sid": "AllowEC2ReadOnly",
      "Effect": "Allow",
      "Action": "ec2:Describe*",
      "Resource": "*"
    },
    {
      "Sid": "AllowListAppBucket",
      "Effect": "Allow",
      "Action": "s3:ListBucket",
      "Resource": "arn:aws:s3:::my-app-bucket"
    },
    {
      "Sid": "AllowS3ObjectAccess",
      "Effect": "Allow",
      "Action": [
        "s3:GetObject",
        "s3:PutObject",
        "s3:DeleteObject"
      ],
      "Resource": "arn:aws:s3:::my-app-bucket/*"
    },
    {
      "Sid": "DenyStoppingProductionInstances",
      "Effect": "Deny",
      "Action": [
        "ec2:StopInstances",
        "ec2:TerminateInstances"
      ],
      "Resource": "arn:aws:ec2:*:*:instance/*",
      "Condition": {
        "StringEquals": {
          "aws:ResourceTag/Environment": "production"
        }
      }
    }
  ]
}

The final statement is an explicit deny: no identity with this policy can stop or terminate an instance tagged Environment=production, whatever other policies allow. Earlier versions of this guide used a deny that combined aws:RequestedRegion with an EC2-specific tag key under Action: "*", which does not mean what it appears to; scope a deny to the actions and resource type it is meant to protect.

Creating an IAM role for EC2:

code
{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Principal": {
        "Service": "ec2.amazonaws.com"
      },
      "Action": "sts:AssumeRole"
    }
  ]
}
code
# Create the role with a trust policy that lets EC2 assume it
aws iam create-role \
  --role-name EC2-S3-Access-Role \
  --assume-role-policy-document file://trust-policy.json

# Attach permissions (a managed policy here; prefer a scoped customer managed policy)
aws iam attach-role-policy \
  --role-name EC2-S3-Access-Role \
  --policy-arn arn:aws:iam::aws:policy/AmazonS3ReadOnlyAccess

# EC2 receives a role through an instance profile
aws iam create-instance-profile \
  --instance-profile-name EC2-S3-Access-Profile

aws iam add-role-to-instance-profile \
  --instance-profile-name EC2-S3-Access-Profile \
  --role-name EC2-S3-Access-Role

The console creates the instance profile for you; the CLI does not. AmazonS3ReadOnlyAccess is broad, so for a real workload attach a customer managed policy scoped to the buckets it needs.

## 2. Elastic Compute Cloud (EC2)

Concept: Virtual servers in the cloud with flexible compute capacity.

Instance families. The letters in a name carry meaning: the first is the series, the number is the generation, and trailing letters are options. A g means an Arm-based AWS Graviton processor, a means AMD, and i means Intel, so m8g and m8i are the same general purpose series on different processors.

CategoryCurrent examplesUse for
General purposeT3, T4g, M7i, M8i, M8gBalanced compute, memory, and networking; burstable T types for light workloads
Compute optimizedC7i, C8i, C8gCPU-bound services, batch, encoding
Memory optimizedR7i, R8i, R8g, X8gLarge in-memory datasets and databases
Storage optimizedI7i, I8g, D3High local I/O and dense storage
Accelerated computingG6, G6e, P5, Trn2, Inf2GPU, AI training, and inference

The EC2 documentation still lists older families such as M5 and C5 as current generation, but newer generations generally offer better price and performance. Graviton instances need Arm-compatible software and container images, so test before migrating.

Purchase options:

  • →On-Demand instances are billed in one-second increments with a 60-second minimum.
  • →Savings Plans trade a one- or three-year spend commitment for lower rates; AWS advertises savings of up to 72 percent compared with On-Demand.
  • →Reserved Instances are the older commitment model, tied to specific instance attributes.
  • →Spot Instances use spare capacity at a discount of up to 90 percent compared with On-Demand. The Spot price is set by Amazon EC2, not by bidding, and AWS can interrupt a Spot Instance, so use it for fault-tolerant work.

Launching an instance:

code
# Create an Ed25519 key pair
aws ec2 create-key-pair \
  --key-name my-key-pair \
  --key-type ed25519 \
  --query 'KeyMaterial' \
  --output text > my-key-pair.pem

chmod 400 my-key-pair.pem

# Create a security group in a specific VPC
SG_ID=$(aws ec2 create-security-group \
  --group-name web-server-sg \
  --description "Security group for web servers" \
  --vpc-id "$VPC_ID" \
  --query 'GroupId' --output text)

# HTTP from anywhere; SSH only from an administrative CIDR range
aws ec2 authorize-security-group-ingress \
  --group-id "$SG_ID" --protocol tcp --port 80 --cidr 0.0.0.0/0

aws ec2 authorize-security-group-ingress \
  --group-id "$SG_ID" --protocol tcp --port 22 --cidr 203.0.113.0/24

# Launch an instance from the latest Amazon Linux 2023 AMI
aws ec2 run-instances \
  --image-id resolve:ssm:/aws/service/ami-amazon-linux-latest/al2023-ami-kernel-default-x86_64 \
  --instance-type t3.micro \
  --key-name my-key-pair \
  --subnet-id "$SUBNET_ID" \
  --security-group-ids "$SG_ID" \
  --iam-instance-profile Name=EC2-S3-Access-Profile \
  --metadata-options HttpTokens=required,HttpEndpoint=enabled \
  --user-data file://user-data.sh \
  --tag-specifications 'ResourceType=instance,Tags=[{Key=Name,Value=WebServer},{Key=Environment,Value=production}]'

Changes from the older version of this snippet: the image comes from an SSM parameter for the latest Amazon Linux 2023 AMI instead of a hard-coded ami-... ID that goes stale (Amazon Linux 2 reached end of support on June 30, 2026); the security group is created in an explicit VPC and referenced by ID, because --security-groups by name only works in a default VPC; SSH is limited to an administrative range instead of 0.0.0.0/0 (AWS Systems Manager Session Manager avoids opening port 22 at all); and the instance requires IMDSv2 for its metadata service.

User data script (Amazon Linux 2023 uses dnf):

code
#!/bin/bash
# Amazon Linux 2023 uses dnf
dnf update -y
dnf install -y docker amazon-cloudwatch-agent

systemctl enable --now docker
usermod -aG docker ec2-user

# Pull and run the application from Amazon ECR
REGION=us-east-1
ACCOUNT_ID=123456789012
REGISTRY="${ACCOUNT_ID}.dkr.ecr.${REGION}.amazonaws.com"

aws ecr get-login-password --region "$REGION" \
  | docker login --username AWS --password-stdin "$REGISTRY"

docker run -d --name myapp --restart unless-stopped \
  -p 80:3000 "${REGISTRY}/myapp:1.4.2"

Docker is installed from the Amazon Linux repositories, the CloudWatch agent from the same repositories, and the application image comes from Amazon Elastic Container Registry (ECR) with a pinned tag rather than a latest image from another cloud's registry. The instance role needs ECR pull permissions.

Launch template and Auto Scaling group:

code
# Launch template data: the image is resolved from an SSM parameter at launch time
cat > launch-template-data.json <<EOF
{
  "ImageId": "resolve:ssm:/aws/service/ami-amazon-linux-latest/al2023-ami-kernel-default-x86_64",
  "InstanceType": "t3.micro",
  "KeyName": "my-key-pair",
  "SecurityGroupIds": ["$SG_ID"],
  "IamInstanceProfile": { "Name": "EC2-S3-Access-Profile" },
  "MetadataOptions": { "HttpTokens": "required", "HttpEndpoint": "enabled" },
  "UserData": "$(base64 -w 0 user-data.sh)",
  "TagSpecifications": [{
    "ResourceType": "instance",
    "Tags": [
      { "Key": "Name", "Value": "WebServer" },
      { "Key": "Environment", "Value": "production" }
    ]
  }]
}
EOF

aws ec2 create-launch-template \
  --launch-template-name web-server-template \
  --version-description "Version 1" \
  --launch-template-data file://launch-template-data.json

# Auto Scaling group across three private subnets, registered with a target group
aws autoscaling create-auto-scaling-group \
  --auto-scaling-group-name web-server-asg \
  --launch-template 'LaunchTemplateName=web-server-template,Version=$Latest' \
  --min-size 2 \
  --max-size 10 \
  --desired-capacity 3 \
  --vpc-zone-identifier "$SUBNET_A,$SUBNET_B,$SUBNET_C" \
  --target-group-arns "$TARGET_GROUP_ARN" \
  --health-check-type ELB \
  --health-check-grace-period 300

# Keep average CPU near 70 percent
aws autoscaling put-scaling-policy \
  --auto-scaling-group-name web-server-asg \
  --policy-name cpu-target-tracking \
  --policy-type TargetTrackingScaling \
  --target-tracking-configuration '{
    "PredefinedMetricSpecification": {
      "PredefinedMetricType": "ASGAverageCPUUtilization"
    },
    "TargetValue": 70.0
  }'

An Auto Scaling group takes subnets through --vpc-zone-identifier, not --availability-zones, when instances run in a VPC. With --health-check-type ELB, the group replaces instances that the load balancer reports unhealthy.

## 3. Simple Storage Service (S3)

Concept: Object storage designed for 99.999999999 percent (11 nines) durability.

Storage classes:

ClassDesigned for
S3 StandardFrequently accessed data
S3 Express One ZoneSingle-digit-millisecond access in one AZ for latency-sensitive workloads
S3 Intelligent-TieringUnknown or changing access patterns; moves objects between tiers automatically
S3 Standard-IAInfrequently accessed data that still needs millisecond access (30-day minimum)
S3 One Zone-IARe-creatable infrequent data in a single AZ
S3 Glacier Instant RetrievalArchive data accessed about once a quarter, millisecond access (90-day minimum)
S3 Glacier Flexible RetrievalArchives retrieved in minutes to hours
S3 Glacier Deep ArchiveLowest cost, retrieval in hours (180-day minimum)

Defaults that changed: since January 5, 2023, every new object is encrypted at rest with SSE-S3 at no extra cost; new buckets block public access and disable ACLs (the Object Ownership setting defaults to bucket owner enforced). Scripts no longer need to turn these on, and bucket policies should not rely on ACLs.

Creating and configuring a bucket:

code
# Create the bucket (bucket names are globally unique)
aws s3api create-bucket --bucket my-app-bucket-12345 --region us-east-1

# New buckets already block public access and encrypt with SSE-S3;
# setting both explicitly keeps the intent visible in scripts
aws s3api put-public-access-block \
  --bucket my-app-bucket-12345 \
  --public-access-block-configuration \
  BlockPublicAcls=true,IgnorePublicAcls=true,BlockPublicPolicy=true,RestrictPublicBuckets=true

# Enable versioning
aws s3api put-bucket-versioning \
  --bucket my-app-bucket-12345 \
  --versioning-configuration Status=Enabled

# Use SSE-KMS with a bucket key instead of the default SSE-S3
aws s3api put-bucket-encryption \
  --bucket my-app-bucket-12345 \
  --server-side-encryption-configuration '{
    "Rules": [{
      "ApplyServerSideEncryptionByDefault": {
        "SSEAlgorithm": "aws:kms",
        "KMSMasterKeyID": "arn:aws:kms:us-east-1:123456789012:key/12345678-1234-1234-1234-123456789012"
      },
      "BucketKeyEnabled": true
    }]
  }'

# Apply the lifecycle policy and CORS rules
aws s3api put-bucket-lifecycle-configuration \
  --bucket my-app-bucket-12345 \
  --lifecycle-configuration file://lifecycle-policy.json

aws s3api put-bucket-cors \
  --bucket my-app-bucket-12345 \
  --cors-configuration file://cors-config.json

# Server access logging (the target bucket must use SSE-S3 default encryption)
aws s3api put-bucket-logging \
  --bucket my-app-bucket-12345 \
  --bucket-logging-status '{
    "LoggingEnabled": {
      "TargetBucket": "my-logs-bucket",
      "TargetPrefix": "s3-access-logs/"
    }
  }'

lifecycle-policy.json:

code
{
  "Rules": [
    {
      "ID": "tier-down-and-expire-old-versions",
      "Status": "Enabled",
      "Filter": { "Prefix": "" },
      "Transitions": [
        { "Days": 30, "StorageClass": "STANDARD_IA" },
        { "Days": 90, "StorageClass": "GLACIER_IR" }
      ],
      "NoncurrentVersionTransitions": [
        { "NoncurrentDays": 30, "StorageClass": "GLACIER_IR" }
      ],
      "NoncurrentVersionExpiration": { "NoncurrentDays": 365 }
    }
  ]
}

By default, objects smaller than 128 KB are not transitioned to another storage class, so tiering rules mostly affect larger objects. cors-config.json:

code
{
  "CORSRules": [
    {
      "AllowedOrigins": ["https://example.com"],
      "AllowedMethods": ["GET", "PUT", "POST", "DELETE"],
      "AllowedHeaders": ["*"],
      "ExposeHeaders": ["ETag"],
      "MaxAgeSeconds": 3000
    }
  ]
}

For server access logging, the destination bucket must also grant the logging service principal (logging.s3.amazonaws.com) write access through a bucket policy, and it must use SSE-S3 default encryption rather than SSE-KMS; without the policy, put-bucket-logging fails.

S3 bucket policy:

code
{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Sid": "DenyInsecureTransport",
      "Effect": "Deny",
      "Principal": "*",
      "Action": "s3:*",
      "Resource": [
        "arn:aws:s3:::my-app-bucket-12345",
        "arn:aws:s3:::my-app-bucket-12345/*"
      ],
      "Condition": {
        "Bool": {
          "aws:SecureTransport": "false"
        }
      }
    },
    {
      "Sid": "AllowCloudFrontServicePrincipalReadOnly",
      "Effect": "Allow",
      "Principal": {
        "Service": "cloudfront.amazonaws.com"
      },
      "Action": "s3:GetObject",
      "Resource": "arn:aws:s3:::my-app-bucket-12345/public/*",
      "Condition": {
        "StringEquals": {
          "AWS:SourceArn": "arn:aws:cloudfront::123456789012:distribution/EDFDVBD6EXAMPLE"
        }
      }
    }
  ]
}

Two changes from the earlier policy. First, the public Principal: "*" read statement is gone: it conflicts with Block Public Access, which is on by default and should stay on. Second, CloudFront access uses origin access control (OAC) through the cloudfront.amazonaws.com service principal and a AWS:SourceArn condition that pins the distribution, instead of an origin access identity (OAI). AWS marks OAI as legacy and not recommended, and OAC supports SSE-KMS and all Regions.

## 4. Virtual Private Cloud (VPC)

Concept: An isolated virtual network in the AWS cloud.

Components:

  • →Subnets are IP address ranges within the VPC, each in one AZ.
  • →Route tables control where traffic goes.
  • →Internet gateway connects the VPC to the internet.
  • →NAT gateway gives private subnets outbound-only internet access.
  • →Security groups are stateful firewalls attached to network interfaces.
  • →Network ACLs are stateless, subnet-level rules.
  • →Gateway endpoints keep traffic to S3 and DynamoDB on the AWS network.

Creating a VPC with Terraform:

code
data "aws_availability_zones" "available" {
  state = "available"
}

locals {
  azs        = slice(data.aws_availability_zones.available.names, 0, 3)
  az_indexes = { for index, az in local.azs : az => index }
}

resource "aws_vpc" "main" {
  cidr_block           = "10.0.0.0/16"
  enable_dns_hostnames = true
  enable_dns_support   = true

  tags = {
    Name        = "main-vpc"
    Environment = "production"
  }
}

resource "aws_internet_gateway" "main" {
  vpc_id = aws_vpc.main.id

  tags = {
    Name = "main-igw"
  }
}

resource "aws_subnet" "public" {
  for_each = local.az_indexes

  vpc_id                  = aws_vpc.main.id
  cidr_block              = cidrsubnet(aws_vpc.main.cidr_block, 8, each.value)
  availability_zone       = each.key
  map_public_ip_on_launch = true

  tags = {
    Name = "public-${each.key}"
    Type = "public"
  }
}

resource "aws_subnet" "private" {
  for_each = local.az_indexes

  vpc_id            = aws_vpc.main.id
  cidr_block        = cidrsubnet(aws_vpc.main.cidr_block, 8, each.value + 10)
  availability_zone = each.key

  tags = {
    Name = "private-${each.key}"
    Type = "private"
  }
}

# One NAT gateway per AZ keeps outbound traffic working if a zone fails
resource "aws_eip" "nat" {
  for_each = local.az_indexes

  domain = "vpc"

  tags = {
    Name = "nat-eip-${each.key}"
  }
}

resource "aws_nat_gateway" "main" {
  for_each = local.az_indexes

  allocation_id = aws_eip.nat[each.key].id
  subnet_id     = aws_subnet.public[each.key].id

  tags = {
    Name = "nat-${each.key}"
  }

  depends_on = [aws_internet_gateway.main]
}

resource "aws_route_table" "public" {
  vpc_id = aws_vpc.main.id

  route {
    cidr_block = "0.0.0.0/0"
    gateway_id = aws_internet_gateway.main.id
  }

  tags = {
    Name = "public-route-table"
  }
}

resource "aws_route_table" "private" {
  for_each = local.az_indexes

  vpc_id = aws_vpc.main.id

  route {
    cidr_block     = "0.0.0.0/0"
    nat_gateway_id = aws_nat_gateway.main[each.key].id
  }

  tags = {
    Name = "private-route-table-${each.key}"
  }
}

resource "aws_route_table_association" "public" {
  for_each = aws_subnet.public

  subnet_id      = each.value.id
  route_table_id = aws_route_table.public.id
}

resource "aws_route_table_association" "private" {
  for_each = aws_subnet.private

  subnet_id      = each.value.id
  route_table_id = aws_route_table.private[each.key].id
}

# Gateway endpoint: S3 traffic from private subnets stays on the AWS network
# and does not pass through the NAT gateways
resource "aws_vpc_endpoint" "s3" {
  vpc_id            = aws_vpc.main.id
  service_name      = "com.amazonaws.us-east-1.s3"
  vpc_endpoint_type = "Gateway"
  route_table_ids   = [for table in aws_route_table.private : table.id]
}

resource "aws_security_group" "web" {
  name        = "web-sg"
  description = "Security group for web servers"
  vpc_id      = aws_vpc.main.id

  tags = {
    Name = "web-security-group"
  }
}

resource "aws_vpc_security_group_ingress_rule" "web_http" {
  security_group_id = aws_security_group.web.id
  ip_protocol       = "tcp"
  from_port         = 80
  to_port           = 80
  cidr_ipv4         = "0.0.0.0/0"
}

resource "aws_vpc_security_group_ingress_rule" "web_https" {
  security_group_id = aws_security_group.web.id
  ip_protocol       = "tcp"
  from_port         = 443
  to_port           = 443
  cidr_ipv4         = "0.0.0.0/0"
}

resource "aws_vpc_security_group_egress_rule" "web_all" {
  security_group_id = aws_security_group.web.id
  ip_protocol       = "-1"
  cidr_ipv4         = "0.0.0.0/0"
}

resource "aws_security_group" "database" {
  name        = "database-sg"
  description = "Security group for databases"
  vpc_id      = aws_vpc.main.id

  tags = {
    Name = "database-security-group"
  }
}

# The database accepts PostgreSQL traffic only from the web tier
resource "aws_vpc_security_group_ingress_rule" "database_from_web" {
  security_group_id            = aws_security_group.database.id
  referenced_security_group_id = aws_security_group.web.id
  ip_protocol                  = "tcp"
  from_port                    = 5432
  to_port                      = 5432
}

Notes on this configuration:

  • →Resources that repeat per AZ use for_each keyed by AZ name, and the AZ list comes from a data source instead of an undeclared reference.
  • →A NAT gateway in each AZ keeps outbound traffic working if a zone fails, but each gateway has an hourly charge and a data processing charge. AWS has added regional NAT gateways that expand across AZs automatically; weigh them against this layout. See AWS Multi-AZ High Availability Architecture for the failure-domain tradeoffs and Cloud Cost Optimization and FinOps Basics for NAT cost patterns.
  • →The S3 gateway endpoint keeps S3 traffic from private subnets off the NAT gateways.
  • →Security group rules are separate resources, the pattern the AWS provider documentation recommends over inline rules. The database group accepts traffic only from the web group.

Terraform Infrastructure as Code: Complete Guide covers the workflow and state handling around code like this.

## 5. Elastic Load Balancing (ELB)

Types:

  • →Application Load Balancer (ALB) handles HTTP and HTTPS traffic at layer 7.
  • →Network Load Balancer (NLB) handles TCP and UDP traffic at layer 4.
  • →Gateway Load Balancer (GWLB) fronts third-party virtual appliances.
  • →Classic Load Balancer is the previous generation; AWS recommends migrating to a current type.

Creating an Application Load Balancer:

code
# Create an internet-facing Application Load Balancer
aws elbv2 create-load-balancer \
  --name web-alb \
  --subnets "$SUBNET_A" "$SUBNET_B" \
  --security-groups "$SG_ID" \
  --scheme internet-facing \
  --type application \
  --ip-address-type ipv4 \
  --tags Key=Name,Value=web-alb Key=Environment,Value=production

# Create a target group (type ip suits containers; instance suits EC2 targets)
aws elbv2 create-target-group \
  --name web-targets \
  --protocol HTTP \
  --port 80 \
  --vpc-id "$VPC_ID" \
  --target-type instance \
  --health-check-protocol HTTP \
  --health-check-path /health \
  --health-check-interval-seconds 30 \
  --health-check-timeout-seconds 5 \
  --healthy-threshold-count 2 \
  --unhealthy-threshold-count 3 \
  --matcher HttpCode=200

# HTTPS listener with an explicit, current TLS policy
aws elbv2 create-listener \
  --load-balancer-arn "$ALB_ARN" \
  --protocol HTTPS \
  --port 443 \
  --ssl-policy ELBSecurityPolicy-TLS13-1-2-Res-PQ-2025-09 \
  --certificates CertificateArn="$CERT_ARN" \
  --default-actions Type=forward,TargetGroupArn="$TARGET_GROUP_ARN"

# Path-based routing rule
aws elbv2 create-rule \
  --listener-arn "$LISTENER_ARN" \
  --priority 10 \
  --conditions Field=path-pattern,Values='/api/*' \
  --actions Type=forward,TargetGroupArn="$API_TARGET_GROUP_ARN"

Specify the TLS policy explicitly. A listener created through the AWS CLI, CloudFormation, or the CDK without --ssl-policy defaults to ELBSecurityPolicy-2016-08, an old policy, while the console defaults to ELBSecurityPolicy-TLS13-1-2-Res-PQ-2025-09, which is also the policy AWS recommends. Targets for ECS tasks on Fargate use target type ip, because each task has its own network interface.

# Planning a migration

A migration plan is a sequence of decisions, not a single tool. The numbers a project reports depend entirely on the starting point, so treat any published "30 percent cheaper" or "10x faster" figure as an anecdote and measure your own baseline.

  1. •Assess. Discover applications and dependencies, and choose a strategy for each workload. AWS's prescriptive guidance lists seven: retire, retain, rehost, relocate, repurchase, replatform, and refactor.
  2. •Build the landing zone. Use multiple accounts under AWS Organizations, a VPC design with public and private subnets, AWS Transit Gateway for inter-VPC connectivity, and AWS Direct Connect or VPN for hybrid connectivity.
  3. •Migrate in waves. Rehost servers with AWS Transform MGN (the service formerly named AWS Application Migration Service), move containers to Amazon ECS or EKS, and refactor suitable components to serverless.
  4. •Secure. Enable AWS Config for configuration compliance, AWS Security Hub CSPM for posture checks against standards such as CIS and PCI DSS, Amazon GuardDuty for threat detection, and AWS WAF for web application protection.
  5. •Operate and optimize. Use CloudWatch for metrics and logs, AWS Cost Explorer and Budgets for spend, Auto Scaling for elasticity, and Savings Plans for steady workloads.

# Common issues and troubleshooting

## Issue 1: EC2 instance not accessible

Symptoms:

  • →Cannot connect over SSH or RDP
  • →Connection timeouts

Diagnosis:

code
# Check instance status
aws ec2 describe-instance-status --instance-ids i-1234567890abcdef0

# Check security group rules
aws ec2 describe-security-groups --group-ids sg-0123456789abcdef0

# Check the route table associated with the subnet
aws ec2 describe-route-tables \
  --filters "Name=association.subnet-id,Values=subnet-12345678"

Solutions:

  • →Verify the security group allows the inbound port from your source address.
  • →Confirm the instance has a public IP or Elastic IP if you connect over the internet.
  • →Check network ACL rules, which are stateless and need both directions.
  • →Verify the subnet's route table has a route to an internet gateway.
  • →Check key pair file permissions (chmod 400) and the login user (ec2-user on Amazon Linux).
  • →Use VPC Reachability Analyzer to test the path, or connect through Systems Manager Session Manager when the instance has the SSM agent and an instance profile.

## Issue 2: S3 access denied

Symptoms:

  • →403 Forbidden errors
  • →Access Denied messages

Diagnosis:

code
# Check the bucket policy and Block Public Access settings
aws s3api get-bucket-policy --bucket my-bucket
aws s3api get-public-access-block --bucket my-bucket

# Check object ownership (ACLs are disabled by default on new buckets)
aws s3api get-bucket-ownership-controls --bucket my-bucket

# Test what an identity is allowed to do
aws iam simulate-principal-policy \
  --policy-source-arn arn:aws:iam::123456789012:role/my-role \
  --action-names s3:GetObject \
  --resource-arns arn:aws:s3:::my-bucket/myfile.txt

Solutions:

  • →Review the bucket policy for an explicit deny, such as a TLS-only or VPC-endpoint condition the caller does not meet.
  • →Check the identity's IAM policy, any permissions boundary, and SCPs.
  • →If the bucket uses SSE-KMS, the caller also needs permission on the KMS key.
  • →Remember that Block Public Access overrides policies that grant public access.
  • →Cross-account access needs both the bucket policy and the caller's IAM policy to allow it.

## Issue 3: unexpectedly high AWS costs

Symptoms:

  • →Bill increases
  • →Budget alerts triggered

Diagnosis:

code
# Cost by service for one month (the end date is exclusive)
aws ce get-cost-and-usage \
  --time-period Start=2026-09-01,End=2026-10-01 \
  --granularity MONTHLY \
  --metrics UnblendedCost \
  --group-by Type=DIMENSION,Key=SERVICE

# Find unused resources
aws ec2 describe-volumes --filters "Name=status,Values=available"
aws ec2 describe-addresses \
  --query 'Addresses[?AssociationId==null]'
aws rds describe-db-instances \
  --query 'DBInstances[].{id:DBInstanceIdentifier,status:DBInstanceStatus}'

Solutions:

  • →Delete unattached EBS volumes and old snapshots, and release unassociated Elastic IPs.
  • →Stop or terminate idle instances and right-size the rest.
  • →Check NAT gateway data processing charges and add gateway endpoints for S3 and DynamoDB.
  • →Use Savings Plans for steady usage and S3 Intelligent-Tiering or lifecycle rules for data with changing access patterns.
  • →Turn on AWS Cost Anomaly Detection and budget alerts.

# Best practices

AWS organizes its architecture guidance into the six pillars of the Well-Architected Framework: operational excellence, security, reliability, performance efficiency, cost optimization, and sustainability.

## Security

  • →Use federation and roles for people and workloads, and require MFA wherever IAM users or the root user remain.
  • →Encrypt data at rest and in transit, and enable CloudTrail for audit logging.
  • →Store credentials in AWS Secrets Manager or Systems Manager Parameter Store rather than in code.

## Reliability

  • →Deploy across multiple AZs, use Auto Scaling groups with load balancer health checks, and prefer managed services.
  • →Design for failure, and test recovery.

## Cost optimization

  • →Right-size instances, remove unused resources, and match purchase options to workload shape.
  • →Use S3 lifecycle policies and monitor with Cost Explorer.

## Performance efficiency

  • →Put CloudFront in front of static and cacheable content, cache close to the application, and choose instance families and Graviton where software allows.

## Operational excellence and sustainability

  • →Define infrastructure as code, deploy through CI/CD pipelines, and monitor with CloudWatch.
  • →Review workloads regularly against the Well-Architected Framework, including its sustainability pillar.

# Key takeaways

  • →AWS reports 39 Regions and 124 Availability Zones; design for multiple AZs and use AZ IDs when accounts must agree on a physical zone.
  • →Prefer federated, temporary credentials and IAM roles over long-term access keys, and require phishing-resistant MFA where users or root remain.
  • →New S3 buckets encrypt with SSE-S3, block public access, and disable ACLs by default; use CloudFront origin access control, not origin access identity, to serve private buckets.
  • →Resolve AMIs from SSM parameters and use Amazon Linux 2023, because Amazon Linux 2 reached end of support on June 30, 2026.
  • →Set an explicit TLS policy on HTTPS listeners created by the CLI or infrastructure as code, since their default is the old ELBSecurityPolicy-2016-08.
  • →Spot prices are set by EC2, not by bidding, and Spot capacity can be interrupted.
  • →NAT gateways are a recurring cost and a failure domain, so use gateway endpoints for S3 and compare per-AZ and regional NAT gateway designs.

# Further reading

Test yourself: AWS Cloud Fundamentals assessment

All posts