What is AWS EC2 and How to Deploy an Environment on It

With over 32 percent of the entire world’s public cloud share, it’s no surprise that AWS serves more than 190 countries with scalable, reliable, and low-cost infrastructure. One of its most powerful and commonly used services are Amazon EC2 (Elastic Cloud Compute).

Amazon EC2 provides scalable computing capacity in the AWS cloud. Leveraging it enables organizations to develop and deploy applications faster, without needing to invest in hardware upfront. Users can launch virtual servers, configure security and networking, and manage cookies from an intuitive dashboard. 

In this article, we’ll talk about the following topics: 

1. Why is AWS EC2 important?

2. What is AWS EC2?

3. Use case: Notifying users about a newsletter

Amazon Web Services (AWS) Career Guide

The Quick Path to Becoming a Solutions ArchitectDownload Now
Amazon Web Services (AWS) Career Guide

Why is AWS EC2 important?

  1. You don’t require any hardware units
  2. Easily scalable (up or down)
  3. You only pay for what you use
  4. You have complete control
  5. Highly secure
  6. You can access your assets from anywhere in the world

What is AWS EC2?

Among the vast array of services that Amazon offers, EC2 is the core compute component of the technology stack. In practice, EC2 makes life easier for developers by providing secure, and resizable compute capacity in the cloud. It greatly eases the process of scaling up or down, can be integrated into several other services, and comes with a plan where you only pay for how much you use it. 

Let’s look at EC2 in action. 

Learn about the AWS architectural principles and services like IAM, VPC, EC2, EBS and more with the AWS Solutions Architect Course. Register today.

Use Case: Notifying Users about a Newsletter

Imagine if your user base is enjoying your product. How would you let them know about the other services you offer? 

That’s where AWS comes in. With Amazon Simple Notification Service (SNS), EC2, and Simple Storage Service (S3), you should be able to do everything you want with ease. You’ll be able to notify users every time the company creates a newsletter, for example. 

Here’s how:

1. Create an AWS account 

2. Set up an EC2 instance 

If at some point in the future, you wanted to create an application using the resources you’ve stored on S3, you’ll need to create an instance EC2.

2a) Choosing an AMI (Amazon Machine Image):

An AMI is a template that is used to create a new instance—or virtual machine—based on user requirements. The AMI will contain information about the software, operating system, volume, and access permissions. There are two types of AMIs:

i) Predefined AMIs: Amazon creates these, and the user can modify them.

ii) Custom AMIs: The user also creates these, and they can be reused. These AMIs are also available in the AMI Marketplace 

2b) Choosing an instance type:

An instance type specifies the hardware specifications that are required in the machine from the previous step. Instance types belong to five main families:

i) Compute-optimized: For situations that require a lot of processing power 

ii) Memory-optimized: For setting up something to do with your in-memory cache

iii) GPU optimized: For setting up a gaming system, or something with the requirement of a large graphic

iv) Storage optimized: When you need to set up a storage server

v) General-purpose: When everything is equally balanced

Instance types are fixed, and their configurations cannot be altered. 

2c) Configure Instance:

You have to specify the number of instances, purchasing options, the kind of network, the subnet, assign a public IP, set the IAM role, the shutdown behavior, etc. On that note, stopping the system and terminating the system under ‘Shutdown behavior’ are completely different things.

Stopping = Temporarily shutting down the system

Terminating = Returning control to Amazon

Under the advanced details, users can also add bootstrap scripts that are executed when the virtual machine starts up. It also offers multiple payment options, such as: 

i) On-demand instances: Can be launched whenever the user requires normal rates

ii) Reserved instances: These instances are reserved for one year or three years. The entire amount has to be paid upfront or over a span of a few months.

iii) Spot instances: Bidding goes to the bidder with the highest bid. These instances are available at a lesser cost than on-demand instances.

2d) Adding Storage: 

You’re tasked with deciding the type of storage, which could be: 

i) Ephemeral Storage (temporary and free)  

ii) Amazon Elastic Block Store (permanent and paid) 

iii) Amazon S3

The size (in GBs), volume type, where the disk is mounted, and whether the volume needs to be encrypted needs to be specified. Free users get to access up to 30 GBs of SSD or magnetic storage (which can be found under ‘Volume Type’).

AWS Solutions Architect Certification Course

Master AWS Architectural Principles and ServicesEXPLORE COURSE
AWS Solutions Architect Certification Course

2e) Adding tags: 

This helps to identify instances more quickly. 

2f) Configuring security groups: 

These are used to specify rules based on which users are given access to the EC2 instance. You set up the type of security, protocol, the port range, and source (from where the incoming traffic is coming from). Incoming traffic has to be explicitly specified, and outgoing traffic is open.

2g) Review

Click on ‘Launch’ and the instance is created. However, there’s a little more work to be done. 

AWS Account Login

Fig: This dialog will pop up

Private key: The user downloads the private key

Public key: AWS uses the public key to confirm the identity of the user. 

After choosing to create a new pair, a new private key is downloaded as a .pem file.

For the next step, we need to use the following tools: PuTTY and PuTTYgen. PuTTY is generally used when you need to connect a Windows system with a Linux system, which is what we’re doing now. PuTTY doesn’t accept .pem files.

So, using the PuTTY Key Generator, you create a new .ppk file.

Conversion> Insert Key

And load the .pem file.

Select “Save Private Key” and find a location to save the key. 

AWS Account Login

Fig: In the PuTTY configuration tool, provide your IP address and click on “Auth.”

AWS Account Login

Fig: Now click on browse and find the corresponding .ppk file

AWS Login

Fig: Once that’s done, a terminal will open up where you can log in as ec2-user

3. Create an SNS and a topic

4. Make sure the topic is set to “public.”

5. Add subscribers: 

These are the individuals who have opted-in to be notified about your newsletter

6. Create an S3 bucket

7. Set up an event relating it with SNS: 

A notification is sent to the company’s subscribers every time something is added to the bucket

8. Sync the S3 bucket and AWS instance

And that’s it: Your users will be notified.

Discover your strengths and weaknesses in understanding the AWS concepts with this AWS Solutions Architect Practice Test. Try answering now!

Conclusion

Now that you have become familiar with Amazon EC2, you made the first step. If this has inspired you to move forward with a new career in cloud computing or add new skills to your existing ones, check out Simplilearn’s AWS SysOps Associate Certification Training. In this comprehensive course, you will learn everything you need to know to deploy, manage, and operate IT environments on Amazon Web Services.

About the Author

Rahul ArunRahul Arun

Rahul is a Senior Research Analyst at Simplilearn. Blockchain, Cloud Computing, and Machine Learning are some of his favorite topics of discussion. Rahul can be found listening to music, doodling, and gaming.

View More
  • Disclaimer
  • PMP, PMI, PMBOK, CAPM, PgMP, PfMP, ACP, PBA, RMP, SP, and OPM3 are registered marks of the Project Management Institute, Inc.