By Fatskills Exam Guides Team — the exam nerds behind 28,500+ quizzes and 2.1M practice questions across 500+ global exams.
(For AWS Solutions Architect – Associate & Real-World Deployments)
You’re a cloud engineer at a genomics startup. Your team runs high-performance computing (HPC) workloads—think DNA sequencing, financial risk modeling, or 3D rendering—that demand ultra-low latency and high network throughput between servers. If you deploy these workloads on random EC2 instances across AWS’s data centers, your jobs will crawl (or fail) due to network jitter and packet loss.
Enter EC2 Placement Groups: A feature that lets you control where your instances physically run in AWS’s data centers. Think of it like reserving seats on a plane: - Cluster Placement Group: All instances sit in the same rack (lowest latency, highest throughput).- Spread Placement Group: Instances are isolated on separate hardware (for fault tolerance).- Partition Placement Group: Instances are grouped into logical partitions (for large-scale distributed systems like Hadoop).
Why this matters in production:- HPC workloads (e.g., MPI-based simulations) fail or slow to a crawl without cluster placement groups.- Fault-tolerant systems (e.g., multi-AZ databases) break if instances aren’t spread across hardware.- Costly mistakes: Deploying a cluster placement group across AZs (it won’t work) or mixing instance types (performance tanks).
Real-world scenario:You inherit a legacy financial risk modeling app that runs on 20 c5n.18xlarge instances. The app uses MPI (Message Passing Interface) to parallelize calculations. Right now, it takes 4 hours to run—but if you deploy it in a cluster placement group, you can cut that to 30 minutes (and save $1,200/month in compute costs).
c5n.18xlarge
c5n
p4d
i3en
✅ AWS account with admin IAM permissions.✅ VPC with a public subnet (for bastion host) and private subnet (for HPC nodes).✅ Key pair for SSH access.✅ Budget alert (HPC instances are expensive!).
aws ec2 create-placement-group \ --group-name "hpc-cluster" \ --strategy "cluster" \ --region us-east-1
Verify:
aws ec2 describe-placement-groups --group-names "hpc-cluster"
Expected output:
{ "PlacementGroups": [ { "GroupName": "hpc-cluster", "State": "available", "Strategy": "cluster", "GroupId": "pg-1234567890abcdef0" } ] }
⚠️ Trap: If you try to launch instances in multiple AZs, the placement group fails silently (instances launch but aren’t clustered).
We’ll use c5n.18xlarge (100 Gbps networking) with EFA.
aws ec2 run-instances \ --image-id ami-0abcdef1234567890 \ # Amazon Linux 2 with EFA (us-east-1) --instance-type c5n.18xlarge \ --key-name "your-key-pair" \ --security-group-ids "sg-1234567890abcdef0" \ --subnet-id "subnet-1234567890abcdef0" \ --placement "GroupName=hpc-cluster" \ --count 4 \ --tag-specifications 'ResourceType=instance,Tags=[{Key=Name,Value=hpc-node}]' \ --ena-support \ --region us-east-1
Key flags:- --placement "GroupName=hpc-cluster" → Forces instances into the placement group.- --ena-support → Enables Enhanced Networking (required for EFA).- --count 4 → Launches 4 instances (adjust based on workload).
--placement "GroupName=hpc-cluster"
--ena-support
--count 4
Verify EFA is enabled:
ssh -i "your-key-pair.pem" ec2-user@<public-ip-of-bastion> sudo lspci | grep "Elastic Fabric Adapter"
1a:00.0 Ethernet controller: Amazon.com, Inc. Elastic Fabric Adapter (EFA)
On each instance:
sudo ip link set dev eth0 mtu 9001
ip link show eth0 | grep mtu
eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 9001 qdisc mq state UP mode DEFAULT group default qlen 1000
⚠️ Trap: If VPC or subnet doesn’t support Jumbo Frames, this fails silently (packets fragment, performance drops).
On one instance (head node):
sudo yum install -y openmpi-devel mpirun --version
Open MPI v4.1.1, package: Open MPI ...
Run a test MPI job across all nodes:1. Create a hostfile (/home/ec2-user/hostfile) with private IPs of all instances: 10.0.1.10 slots=36 10.0.1.11 slots=36 10.0.1.12 slots=36 10.0.1.13 slots=36 (Each c5n.18xlarge has 36 vCPUs.)
/home/ec2-user/hostfile
10.0.1.10 slots=36 10.0.1.11 slots=36 10.0.1.12 slots=36 10.0.1.13 slots=36
bash mpirun --hostfile hostfile -np 144 hostname
ip-10-0-1-10 ip-10-0-1-10 ... (144 lines, distributed across nodes)
lspci | grep EFA
ip link show eth0
aws fsx create-file-system \ --file-system-type LUSTRE \ --storage-capacity 1200 \ --subnet-ids "subnet-1234567890abcdef0" \ --security-group-ids "sg-1234567890abcdef0" \ --lustre-configuration DeploymentType="SCRATCH_2" \ --region us-east-1
Mount on each instance:
sudo mkdir /fsx sudo mount -t lustre <fsx-dns-name>@tcp:/fsx /fsx
⚠️ Trap: FSx for Lustre is expensive (~$0.14/GB-month). Use S3 as a backend to reduce costs:
sudo mount -t lustre <fsx-dns-name>@tcp:/fsx /fsx -o s3import=<s3-bucket-name>
aws autoscaling suspend-processes
Environment=hpc
Project=genomics
Owner=team-bio
NetworkPacketsIn/Out
EFAErrors
CPUUtilization
/var/log/mpirun.log
/var/log/efa/
aws ec2 describe-images --filters "Name=ena-support,Values=true"
❌ Partition (for distributed systems, not HPC).
"A financial modeling app runs on 10 c5n.18xlarge instances. It’s slow. What’s the issue?"
18xlarge
❌ "Enable EBS optimization" (irrelevant for MPI).
"You need to deploy a fault-tolerant database with 3 nodes. Which placement group?"
"You’re running a genomics workload that processes 10 TB of data daily. It uses MPI and requires <1ms latency between nodes. Cost is a concern. What’s the best setup?"- ✅ Cluster placement group + c5n.18xlarge + EFA + Spot Instances (correct).- ❌ "Use spread placement group" (not for HPC).- ❌ "Use m5.large instances" (too slow for MPI).- ❌ "Use On-Demand only" (Spot saves 90%).
m5.large
Deploy a 2-node HPC cluster with: - Cluster placement group.- EFA-enabled instances (c5n.4xlarge).- Jumbo Frames (MTU 9001).- Run a test MPI job (hostname across both nodes).
c5n.4xlarge
hostname
Constraints:- Use only the AWS CLI (no console).- Free tier eligible (c5n.4xlarge is not free, but you can use t3.micro for testing—just know EFA won’t work).
t3.micro
bash aws ec2 create-placement-group --group-name "test-cluster" --strategy "cluster"
bash aws ec2 run-instances \ --image-id ami-0abcdef1234567890 \ # Amazon Linux 2 with EFA --instance-type c5n.4xlarge \ --key-name "your-key" \ --security-group-ids "sg-1234567890abcdef0" \ --subnet-id "subnet-1234567890abcdef0" \ --placement "GroupName=test-cluster" \ --count 2 \ --ena-support
bash sudo ip link set dev eth0 mtu 9001
10.0.1.10 slots=8 10.0.1.11 slots=8
bash mpirun --hostfile hostfile -np 16 hostname
Why it works:- Cluster placement group ensures low-latency networking.- EFA enables OS-bypass for MPI.- Jumbo Frames prevent packet fragmentation.
aws ec2 create-placement-group --group-name "hpc" --strategy "cluster"
aws ec2 run-instances --placement "GroupName=hpc"
lspci | grep "Elastic Fabric Adapter"
mpirun --hostfile hostfile -np 16 hostname
Join 4M+ learners. Unlock unlimited quizzes, wrong-answer tracking, flashcards + reminders, study guides, and 1-on-1 challenges.