Elastic Compute Cloud (EC2) provides scalable virtual servers (known as instances) in the cloud on-demand.
- EC2 Instances are grouped into families, which are designed for a specific broad type workload.
- A security group must be assigned to an instance during the creation process.
- Each instance must be placed into a VPC, an AZ, and a subnet.
- Custom launch command (bootstrapping) can be passed into the instance via “user-data”
- Encrypted key-pairs are used to manage login authentication.
- You are not billed if an instance is in a state of pending, stopping, stopped, shutting down, or terminated. EBD volumes incur charges regardless of the instance’s state.
- AWS initially used a modified version of the Xen Hypervisor to host EC2 and then switched to Amazon’s own hypervisor Nitro.
- EC2 Instance Role is an IAM role that can be assumed by an EC2 instance. An Instance Profile, which is a container for the roles, allows application on the EC2 instances to access the temporary credentials using the instance metadata.
- Bootstrapping is a process where instructions are executed on an instance during its launch process.
- User Data can be used to run shell scripts (Bash or PowerShell) or run cloud-init directives.
Private or Public Instances
- Private Instances
- Private IP is automatically allocated when an instance is launched and is used for internal communication.
- Allocated with ip-x.x.x.x.ec2.internal DNS name – only works inside AWS.
- The private IP and the domain name are unchanged during stop/starts – released when terminated.
- Public Instances
- A public IP is allocated when the machine starts and deallocated when it stops.
- A Public IPs is auto-assigned based on the subnet settings. But you can assign a public IP to an instance during the launch process.
- Elastic IP (EIP) can be allocated. It is a static IPv4 address and is not deallocated when the instance stops.