Sub topic 1
What EC2 is and what you are responsible for
Prerequisites
This chapter assumes you can use a Linux command line and read IP addresses, CIDR blocks, and port numbers. It also assumes you have an AWS account, know what an IAM user and a permission are, and have used SSH. You don't need to run anything yet. Later chapters launch real instances.
What EC2 provides
Amazon Elastic Compute Cloud (EC2) rents you virtual servers, called instances, on AWS hardware. You choose the operating system image, the CPU and memory size, the network placement, and the storage. You pay for what you run, and you can resize or replace instances as needs change.
An instance behaves like a server you control. You log in, install software, and open ports. The difference is that AWS owns the physical machine, and you create or delete the server with an API call instead of a purchase order.
The building blocks you will meet in this tutorial are:
| Building block | What it decides |
|---|---|
| Region and Availability Zone | Where the instance physically runs |
| AMI | The operating system and software it starts with |
| Instance type | CPU, memory, network, and storage capacity |
| VPC and subnet | Which private network it joins and what IP addresses it gets |
| Security group | Which traffic is allowed in and out |
| Key pair | How you prove who you are over SSH |
| EBS volume | Persistent disk storage |
The shared responsibility model
AWS and you split the work of keeping an instance secure and running. AWS is responsible for security of the cloud. You are responsible for security in the cloud. EC2 is infrastructure as a service, so your share is large.
In practice this means:
- AWS keeps the data center, the host hardware, and the hypervisor (the software that splits a host into instances) secure and working.
- You patch the guest operating system, because AWS does not log in to your instance to update it.
- You configure security groups. A mistake such as opening SSH to the whole internet is yours.
- You decide who may use the instance through IAM and who may log in through key pairs.
- You back up your data. If a disk fails or you delete a volume, AWS will not restore data you never saved.
- You watch the bill. Running instances, volumes, and public IPv4 addresses all cost money until you remove them.
Common mistakes
- Assuming AWS patches your operating system. It patches the underlying host, not the guest.
- Treating an instance as permanent. Instances can be stopped, replaced, or lose data stored on temporary disks, so keep important data on durable storage.
- Granting broad access "just to make it work". Start with the narrowest rule that works.
Exercise
An application on your EC2 instance has a known vulnerability, and an attacker uses it to read files. Is the fix AWS's responsibility or yours? Explain which part of the model applies.
Show answer
It is yours. The application and guest operating system run inside the instance, which falls under security in the cloud. AWS secures the hardware and hypervisor, but you must patch and configure the software, restrict network access, and limit the instance's permissions.