Courses / AWS
1. Amazon EC2
Amazon Elastic Compute Cloud (EC2) provides resizable compute capacity in the cloud.
How It Works
Think of Amazon EC2 as renting a virtual office space where you can set up your business. You can choose the size, location, and resources of your office based on your needs.
You select an Amazon Machine Image (AMI) to define the server configuration.
You choose the instance type that determines the server's resources.
You launch the instance, which creates a virtual server in the cloud.
You can connect to the instance and deploy your applications.
See It
The code above launches a new EC2 instance using a specified AMI, instance type, and key pair for SSH access. You could try changing the instance type to `t2.small` to see how it affects the resources.
aws ec2 run-instances \
--image-id ami-12345678 \
--count 1 \
--instance-type t2.micro \
--key-name MyKeyPairUse It
Launching a web server for an application.
aws ec2 run-instances \
--image-id ami-12345678 \
--count 1 \
--instance-type t2.micro \
--key-name MyKeyPair \
--security-group-ids sg-12345678Using EC2 for launching a web server allows for flexible scaling based on traffic demands.
Break It
What will happen when I run this command?
aws ec2 run-instances \
--image-id ami-12345678 \
--count 1 \
--instance-type t2.microThe command is missing required parameters like `--key-name` and `--security-group-ids`, which are necessary for SSH access and network configuration.
Add the `--key-name` and `--security-group-ids` parameters to the command.
aws ec2 run-instances \
--image-id ami-12345678 \
--count 1 \
--instance-type t2.micro \
--key-name MyKeyPair \
--security-group-ids sg-12345678Level Up
Auto Scaling Groups: This allows you to automatically adjust the number of EC2 instances based on demand, ensuring efficiency and cost-effectiveness.
Elastic Load Balancing: Distributes incoming application traffic across multiple EC2 instances, enhancing availability and fault tolerance.
Prove It
Launch an EC2 instance with a specified AMI, instance type, and security group.
AWS
Amazon EC2
Amazon EC2 allows you to rent virtual servers in the cloud.
"I need to quickly scale my application without investing in physical hardware."
Amazon EC2 provides scalable computing capacity, allowing users to launch and manage virtual servers on-demand.
"I need to quickly scale my application without investing in physical hardware."
Amazon EC2 provides scalable computing capacity, allowing users to launch and manage virtual servers on-demand.