DEV Community

Cover image for Amazon EC2 (Elastic compute cloud ☁πŸ–₯) -Zero to HeroπŸš€πŸš€ (Cheat Sheet)
Tanmay Shukla
Tanmay Shukla

Posted on β€’ Edited on

Amazon EC2 (Elastic compute cloud ☁πŸ–₯) -Zero to HeroπŸš€πŸš€ (Cheat Sheet)

In this series I am going to share multiple articles that will teach you from basic to advanced about EC2. So Lets start !!!

EC2 n

What is EC2 ?

  • EC2 is a web service that provides resizable compute capacity in the cloud.
  • It is designed to make web-scale cloud computing easier for developers.
  • Most popular and most used AWS offering.
  • EC2 = Elastic Compute Cloud = Infrastructure as a service(IaaS)
    • It mainly consists of: – Renting Virtual machines(EC2)
    • Storing data on Virtual drives(EBS)
    • Distributing load across machines(ELB)
    • Scaling the services using an auto-scaling group(ASG)
  • In this you pay only for capacity that you actually use.
  • EC2 Provides developers the tools to build failure resilient applications and isolate themselves from common failure scenarios.

Below are some features of EC2:

1. Reliability

  • EC2 provides 99.9% availability in each region. The services are highly reliable, where replacement of instances can be done easily and rapidly.

2. Cost Saving

  • EC2 is inexpensive as it allows the user to select plans as per the requirement. It helps the users to save cost and utilize the resources fully.
  • User's also get benefits from the AWS scale, which enables the users to pay less for virtual servers than other cloud providers.
  • EC2 works on pay-as-you go model and as a customer we only pay for the time we use EC2.
  • With the use of EC2, we can eliminate the need to invest upfront cost on Capex for hardware (servers).

3. Elasticity

  • Companies can easily increase or decrease capacity within minutes. They can also provision thousands of server instances simultaneously.
  • Apart from that, all the server instances are handled by web service APIs that can scale up and down the servers as per the requirements.

4. Scalability

  • In EC2 we can scale-in and scale-out depending on load. It also provides autoscaling capabilities
  • Auto-scaling is the capability built into AWS that allows you to ensure you have the right number of EC2 instances provisioned to handle the load of your application.
  • We can use EC2 to launch as many virtual machines as per our needs.
  • It provides scalable computing capacity in AWS cloud.
  • It also helps in building application with redundancy and resilience.

5. Security

  • AWS works with Amazon VPC to provide robust networking and security for the compute resources.
  • All the compute instances are located in a VPC (Virtual Private cloud) in a specific range. This specific functions help the user in deciding which instances are exposed to the internet and which remains private EC2.

EC2 sizing & configuration

We can choose from various options in EC2 like below:

  • Operating System(OS): Linux, Windows or macOS
  • Compute power, processors and cores(CPU)
  • Random-access memory(RAM)
  • Storage space:
    • Hardware(EC2 Instance Store)
    • Network-attached storage(EBS & EFS)
  • Firewall Rules: Security group
  • Network card: speed of the card, Public IP address

EC2 User Data

  • We can bootstrap our instances using an EC2 User data script.
  • Bootstrapping means launching commands when a machine starts
  • This script only run once when the instance start.
  • Usecase of EC2 user data is to automate boot tasks such as:
    • Installing updates
    • Installing softwares
    • Downloading common files from the internet
    • A lot more
  • The EC2 user data script runs with the root user

Security Groups

  • Security groups(SG) are the fundamentals of network security in AWS.
  • SG controls, how the traffic is allowed into or out of our instances. SG
  • SG only contain allow rules
  • SG rules can reference by IP or by security group.
  • Security groups acts as a "firewall" for EC2 instances.
  • Security groups regulates :
    • Authorized IP ranges -IPv4 and Ipv6
    • Access to ports (like SSH, HTTP and HTTPS)
    • Control of inbound network(from other to the instance)
    • Control of outbound Network(from instance to other)

EC2 Image Builder

  • It is used to automate the creation of virtual machines and container images.
  • Its a free service i.e. we only for uderlying resources.
  • Crux- Automates the creation, maintain, validate and test EC2 AMIs.
  • We can run it via scheduling(weekly or whenever packages are updated). AWS images builder

Connect with me

Top comments (2)

Collapse
Β 
leewynne profile image
Lee Wynne β€’

Nice post!

Collapse
Β 
tanmaygi profile image
Tanmay Shukla β€’

Thanks you so much. Just trying to document my learning