Hi guys, After many years of working as an AWS Solution Architect in various leading companies here are 20 things You Must Know About Amazon EC2.
Are you ready? Let’s go 🙂
1- EC2 Service will help you create and manage Virtual Machines in AWS
- Every virtual machine is called an EC2 Instance
- EC2 instances are elastic, which means that they can scale up and down (vertical or Horizontal scaling) with with help of a click to match with the requirement of a particular application.
- If you still in your free tier privilege, AWS will allow you to use up to 720hours of free EC2 / month, and when you don’t have that privilege anymore you will jump in the Pay-As-Go plan of AWS.
Best Feature of Amazon EC2
- Persistent storage volumes for your data using Amazon Elastic Block Store (Amazon EBS)
volumes that are elastic in nature and multiple volumes can be added to an instance.
- Multiple physical locations for your resources, known as regions and Availability Zones
- A firewall that enables you to specify the protocols, ports, and source IP ranges that can reach your instances. Also called security groups.
- The option of having Static IP addresses, so that whenever you restart your EC2 instance the IP address doesn’t change is called Elastic IP addresses
- You can create tags and assign them to your Amazon EC2 resources for better management for cost purposes
- Various sizes and capacity of servers are available for you to use as per your requirement.
2- You need certain components to successfully launch an EC2 and SSH into it.
- VPC, Subnet ( they can be default or custom )
- Security Group ( you have the choice to create one or use the default one, Please Note to always make sure that the required port is allowed for easy SSH or RDP)
- Key Pair, You can create your Keypair before the process of spinning up your EC2 instance and select it during the process or you can create one at the end of the process
- Storage (It’s highly recommended to use EBS Volume than instance store)
- AMI (Amazon Machine Image, which is the base of your EC2 instance flavor)
- Instance Type ( this will help you decide on the size of the virtual machine)
3- Different EC2 States
- you can definitely play around with your EC2 instance by navigating to the Instance state tab, There, you will be able to Shutdown, Terminate, Start, Hibernate, Reboot, Stop your EC2 instance. Refer here for more
4- AMI ( Amazon Machine Image) is one of the most important components of your EC2 instance
AMI is basically an OS image, An Amazon Machine Image (AMI) provides the base operating system you need to launch your Virtual Machine.
When choosing An AMI, those following comes with it
- A template for the root volume for the instance (for example, an operating system, an application server, and applications)
- Launch permissions that control which AWS accounts can use the AMI to launch instances
- A block device mapping that specifies the volumes to attach to the instance when it’s launched
- Types of AMI: –> Refer here
- AWS Provided AMI (free)
- Community AMI (free)
- AWS Marketplace AMI (free and paid)
- Your custom AMI’s
” RECOMMENDATION ” Amazon Linux AMI (great for beginners!)
Amazon Linux AMI is supported and maintained Linux images provided by AWS. Some of the features of Amazon AMI’s are
- A stable, secure, and high-performance execution environment for applications running on Amazon EC2.
- Provided at no additional charge to Amazon EC2 users.
- Repository access to multiple versions of MySQL, PostgreSQL, Python, Ruby, Tomcat, and many more common packages.
- Regular updates of components and packages like yum
- Includes packages that enable easy integration with AWS services, such as the AWS CLI, the Boto library for Python, etc.
5- EC2 Tenancy: Are virtual machines on a shared host or not?
- Dedicated ( Needed for compliance and security-sensitive needs)
○ Dedicated Instance ( Your EC2 stays on a host that only is used by you. Host hardware may
○ Dedicated Host( you literally get a physical machine reserved)
- Multi-tenant Type ( Cheap and usually secure)
6- EC2 Public IP address and Elastic IP
- Elastic IP (EIP) is Static(persistent) IP’s that you can create on-demand. They are different than the Public IP you get when you launch an EC2 instance ( if public IP is enabled). You can attach EIP to an EC2 instance.
Elastic IP’s stay with the instance even when the instance is stopped. This is in contrast to the default Public
IP is given to instance, which is released after an instance is stopped.
You always pay for EIP if it’s not attached to a running EC2. So if EC2 is stopped and has Elastic IP, you pay
for the EIP.
- Cloudwatch Services provides basic monitoring for various EC2 instance metrics like
CPU Utilization, Network In/ Out Packets In/Out Disk Read/Writes.
- But does not provide metrics like Memory(RAM) Utilization. You need to install a Cloudwatch agent in your EC2 instance to collect the RAM utilization
- You can create a custom dashboard for all your collected metrics