
Cloud
Learning Level
Amazon EC2 provides resizable compute capacity in the cloud. Launch instances in minutes and scale capacity as needed.
By the end of this lesson, you'll understand:
# Create key pair
aws ec2 create-key-pair --key-name my-key --query 'KeyMaterial' --output text > my-key.pem
chmod 400 my-key.pem
# Launch instance
aws ec2 run-instances \
--image-id ami-0c55b159cbfafe1f0 \
--instance-type t3.micro \
--key-name my-key \
--security-group-ids sg-12345678 \
--tag-specifications 'ResourceType=instance,Tags=[{Key=Name,Value=MyInstance}]'# Get public IP
aws ec2 describe-instances --instance-ids i-1234567890abcdef0 \
--query 'Reservations[0].Instances[0].PublicIpAddress' --output text
# SSH into instance
ssh -i my-key.pem ec2-user@<public-ip># Create security group
aws ec2 create-security-group \
--group-name my-sg \
--description "My security group"
# Add inbound rule
aws ec2 authorize-security-group-ingress \
--group-id sg-12345678 \
--protocol tcp \
--port 22 \
--cidr 0.0.0.0/0# Create volume
aws ec2 create-volume \
--availability-zone us-east-1a \
--size 100 \
--volume-type gp2
# Attach to instance
aws ec2 attach-volume \
--volume-id vol-12345678 \
--instance-id i-1234567890abcdef0 \
--device /dev/sdfLearn about Elastic Beanstalk for managed deployments, or explore Lambda.
Resources
Ojasa Mirai
Master AI-powered development skills through structured learning, real projects, and verified credentials. Whether you're upskilling your team or launching your career, we deliver the skills companies actually need.
Learn Deep • Build Real • Verify Skills • Launch Forward