A hands-on EC2 lab in fifteen slides, in the console and the CLI: find the default VPC, create a key pair, launch the project's web server and connect with SSH; install nginx by hand, see the security group drop the browser and open port 80; stop and start the instance and watch its public address change; give it an Elastic IP address that survives a stop and a start; terminate it, see what outlives it, and clean up.
The slides
The tool is a hands-on lab in fifteen slides, one step each, with the steps to follow beside a terminal and a picture of
the instance, its security group, its key pair and its addresses:
- Introduction: what the lab makes.
- 1. Launch and connect
- Find the default VPC: in the console, and its subnets from the CLI.
- Create a key pair:
project-key, and its private key in ~/.ssh. - Launch the instance:
project-web, Amazon Linux 2023 on a t3.micro, with the security group project-web-sg. - Read the instance from the CLI: its state, AZ and two addresses.
- Connect with SSH: and see that the instance holds only its private address.
- 2. The web server
- Install nginx: by hand, with our own page.
- Show that the security group drops the browser: no rule for port 80.
- Allow HTTP in the security group: the page loads at once.
- 3. Stop and start
- Stop the instance: the public address is gone; the private one stays.
- Start the instance from the CLI: a new public address, the same page.
- 4. An Elastic IP address
- Give the instance an Elastic IP address: allocate and associate it.
- Stop and start with the Elastic IP address: the address stays.
- 5. Terminate and clean up
- Terminate the instance: the root volume goes with it; the Elastic IP address stays.
- Clean up: the address, the security group, the key pair.
The buttons on the left and right edges move between slides. So do the arrow keys and a swipe.
The lab starts where
Getting Started with AWS ends: the CLI works as jane.
The slides
Elastic Compute Cloud (EC2) explain what it uses.
The placeholders
The instance, security group and allocation IDs are AWS's documentation placeholders (i-1234567890abcdef0), and the
addresses are from the documentation ranges: 192.0.2.10 is our computer, 198.51.100.24 and 198.51.100.71 the
instance's two public addresses, 203.0.113.25 the Elastic IP address. The default VPC's range and subnets are the same
in every account.
Sources