Our Support: During the COVID-19 outbreak, we request learners to CALL US for Special Discounts!

- AWS Blogs -

EC2 in AWS - The Backbone of AWS



What is EC2 in aws?

EC2 stands for Elastic Compute Cloud. It enables executing applications on customized cloud instances. So why do we need EC2? Local computer environments are constrained by the availability of hardware resources. Hence, applications can be run on configured ‘instance’ on EC2 cloud. Instance corresponds to a virtual server running on top of physical EC2 resources.EC2 instances come in several different flavors:

For example, instance types can be expressed as :

c4.large, c5.xlarge, r4.large, x1e.8xlarg, i3.large, g3s.xlarge, i3.metal.

EC2 instances can be created using the AWS management console.

  • General Purpose – (A1,T3,T2,M5, M4,M3)
  • Computer Optimized – (C5, C4, C3)
  • Memory Optimized – (X1,Z1,R5,R4,R3)
  • Accelerated Computing (P3, P2, G3, F1)
  • Storage optimized-(I3)
  • Dense-storage Instances – (D2)

Instances are further classified as:

  • Large
  • Xlarge
  • 2xlarge
  • 4xlarge
  • 8xlarge

Once a new EC2 instance has been created, we can connect to the instance using Putty. We can start the Putty application and provide the configuration details for connecting to the instance.

In the SSH section of the configuration, provide the ppk file for the key pair.

The tool puttygen can be used to convert pem keys to ppk format.

Required files can be transferred to the ec2 instance using PuTTY Secure Copy client (PSCP) or WinSCP.

When an EC2 instance is launched, it can be associated with a security group.

AWS Solution Architect Training and Certification

  • Learn from the videos anytime anywhere
  • Pocket-friendly mode of learning
  • Complimentary eBook available
  • Discount Voucher on Live-class

The security group acts as a virtual firewall that controls the traffic to the instance/instance set. An AWS account automatically has a default security group created. A new EC2 instance is automatically associated with the default security group. The security group rules for the EC2 instance control the incoming traffic for an instance.

Amazon EBS volume is a block-level storage device that can be attached to a single EC2 instance. 

AWS Solution Architect Training and Certification

  • No cost for a Demo Class
  • Industry Expert as your Trainer
  • Available as per your schedule
  • Customer Support Available

EBS provides the following volume types: 

EBS volume can be formatted with a filesystem and mounted as a block device.

AWS provides Elastic Volumes with which you can dynamically modify the size, performance, and type of your Amazon EBS volumes without detaching them.

Image result for aws modify volume

RAID stands for Redundant Array of Independent Disks.

Multiple RAID configurations are possible:

Data is split across multiple disks

Redundant data across multiple disks

Data is split across multiple disks together with a parity bit

Data is split across multiple disks together with two parity bits

It combines the advantages of RAID 0 and RAID 1

LogOn to the EC2 instance via mstsc and open the Disk Management utility.


                        Disk Management with a root volume, one instance store volume, and
                            one EBS volume.

Right-click on the volume and select the desired RAID option.

Define storage resources for the selected RAID option.

AMI stands for Amazon Machine Image. An AMI can be created from a running EC2 instance.

Right click on the instance name and choose ”Create Image” from the context menu.

The new AMI will appear in AWS Explorer under the AMIs section.

Instance store is a directly attached, block-device storage associated with an EC2 instance. EBS volumes ,on the other hand,behave like raw, unformatted block devices which can be mounted as devices on your instances. The instance store is suitable for temporary storage. Data stored in instance store volumes is not persistent through instance stops, terminations, or hardware failures. EBS volumes preserve their data across instance stops and terminations. 

Load Balancing provides for efficient distribution of network/application traffic across multiple servers in a cluster. A load balancer accepts incoming traffic from clients and routes requests to its registered targets (e.g. EC2 instances) in one or more Availability Zones. AWS Elastic Load Balancing offers three types of load balancers:

The Amazon Elastic Load Balancing Service Level Agreement commitment is 99.99% availability for a load balancer.

AWS Solution Architect Training and Certification

  • Personalized Free Consultation
  • Access to Our Learning Management System
  • Access to Our Course Curriculum
  • Be a Part of Our Free Demo Class

Load Balancer periodically sends requests to its registered targets to test their status. These tests are called ”health checks”.The load balancer sends a health check request to each registered target every Health Check Interval Seconds seconds(default: 30 for instances), using the specified port, protocol, and ping path. If the health checks  exceed Unhealthy Thres hold Count  consecutive failures (default: 2), the load balancer marks the target as unhealthy.  When the health checks exceed HealthyThres hold Count consecutive successes (default: 5), the load balancer puts the target back in service.

Amazon CloudWatch is a monitoring service for AWS cloud resources and the applications. It records and retains metrics for a period of 15 months.

By default, Amazon EC2 sends metric data to CloudWatch in 5-minute periods. To send metric data for your instance to CloudWatch in 1-minute periods, you can enable detailed monitoring on the instance. 

CloudWatch Metrics can be accessed using:

 

AWS EC2 instances can be accessed using AWS CLI.

For example, For sisplaying list of EC2 commands:

aws ec2 help

For launching a new instance:

aws ec2 run-instances --image-id --count 1 --instance-type t1.micro --key-name --security-groups

Listing instances:

aws ec2 describe-instances --filters "Name=instance-type,Values=t1.micro“

Block-device-mapping parameter can be used to specify additional Amazon EBS volumes or instance store volumes to attach to an instance when it's launched.

--block-device-mappings "[{\"DeviceName\":\"/dev/sdf\",\"Ebs\":{\"VolumeSize\":10,\"DeleteOnTermination\":false}}]"

Adding a tag to an instance:

aws ec2 create-tags --resources --tags Key=Name,Value=MyInstance

Terminate an ec2 instance:

aws ec2 terminate-instances --instance-ids

Keypair management:

aws ec2 create-key-pair …

aws ec2 describe-key-pairs …

aws ec2 delete-key-pair …

For associating Identity and Access Management Roles with EC2 instance, we use the following steps:

Screenshot of choosing Attach/Replace IAM role

Screenshot of choosing the IAM role

Screenshot showing EC2Role1 as the IAM role

Features of AWS S3 can be accessed using AWS CLI.

Displaying list of S3 commands:

aws s3 help

Creating a new S3 bucket:

aws s3 mb

Listing S3 buckets:

aws s3 ls

2019-12-11 15:02:20 my-bucket

2019-12-14 11:54:33 test-bucket

Deleting a bucket:

aws s3 rb

Copy local file to S3 bucket:

aws s3 cp file.txt s3://my-bucket/

Synchronize a local directory with a S3 bucket:

aws s3 sync . s3://my-bucket/path

Move content from S3 bucket to local directory:

aws s3 mv s3://my-bucket/path ./Temp

List the contents of the bucket:

aws s3 ls s3://my-bucket

Delete the contents of the bucket:

aws s3 rm s3://my-bucket/path

In order to determine the region where the bucket resides we can use the command aws s3api get-bucket-location.

For example:

aws s3api get-bucket-location --bucket test-bucket

This generates output of the following format:

{

    "LocationConstraint": "us-west-2"

}

Bootstrap scripts are used to perform common automated configuration tasks after the instance starts. 

Bootstrap script can be configured using CLI or from the console.

CLI:

--bootstrap-actions Path=s3://mybucket/filename

The bootstrap scripts are contained in the user data metadata of the EC2 instance.

Instance metadata is data about your instance that you can use to configure or manage the running instance. Instance metadata is divided into categories. The complete list of categories can be referenced at https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instancedata-data-categories.html 

Instance metadata can be retrieved using the link local address 169.254.169.254 from within the EC2 instance.

For example:

TOKEN=`curl -X PUT "http://169.254.169.254/api/token" -H "X-aws-ec2-metadata-token-ttl-seconds: 21600"` && curl -H "X-aws-ec2-metadata-token: $TOKEN" -v http://169.254.169.254/latest/meta-data/network/interfaces/macs/02:29:96:8f:6a:2d/subnet-id subnet-be9b61d7 (Subnet Id for the instance)

Auto Scaling group : a collection of EC2 instances that are a logical grouping for the purposes of automatic scaling and management.

Launch configuration : an instance configuration template that an Auto Scaling group uses to launch EC2 instances.

Launch Configuration includes 

Placement groups are used to influence the placement of a group of interdependent instances to meet the needs of your workload.

Placement groups can make use of the following strategies:

A placement group can also be created using CLI with the command:

   aws ec2 create-placement-group

Amazon EFS enables us to create file systems that are accessible to EC2 instances via a file system interface.

File Systems can be accessed using the NFS v4 protocol.

Multiple EC2 instances can access an EFS file system simultaneously.

Amazon EFS o?ers two storage classes:

Amazon EFS can be created using the console or CLI.

AWS Lambda lets you run code without provisioning or managing servers. There is no charge when code is not running. This enables serverless computing ( server management is taken care of by AWS).

AWS Solution Architect Training and Certification

  • Detailed Coverage
  • Best-in-class Content
  • Prepared by Industry leaders
  • Latest Technology Covered

Lambda supports Java, Go, PowerShell, Node.js, C#, Python, and Ruby code, and also provides a Runtime API which allows you to use any additional programming languages for your functions. Lambda stores code in Amazon S3 and encrypts it at rest. 

EC2 can be used to build a serverless webpage.

Conclusion

To summarize, EC2 provides scalable computing instances on the cloud. Amazon Machine Images(AMIs) are preconfigured templates for EC2 instances.EC2 instances come in varied instance types based on size and configuration.EC2 instances can make use of instance stores or EBS volume stores for data.EC2 instances can be created, administered and terminated using the console as well as the command line interface.


    Janbask Training

    A dynamic, highly professional, and a global online training course provider committed to propelling the next generation of technology learners with a whole new way of training experience.


Comments

Trending Courses

AWS

  • AWS & Fundamentals of Linux
  • Amazon Simple Storage Service
  • Elastic Compute Cloud
  • Databases Overview & Amazon Route 53

Upcoming Class

4 days 14 Jul 2020

DevOps

  • Intro to DevOps
  • GIT and Maven
  • Jenkins & Ansible
  • Docker and Cloud Computing

Upcoming Class

-0 day 10 Jul 2020

Data Science

  • Data Science Introduction
  • Hadoop and Spark Overview
  • Python & Intro to R Programming
  • Machine Learning

Upcoming Class

6 days 16 Jul 2020

Hadoop

  • Architecture, HDFS & MapReduce
  • Unix Shell & Apache Pig Installation
  • HIVE Installation & User-Defined Functions
  • SQOOP & Hbase Installation

Upcoming Class

7 days 17 Jul 2020

Salesforce

  • Salesforce Configuration Introduction
  • Security & Automation Process
  • Sales & Service Cloud
  • Apex Programming, SOQL & SOSL

Upcoming Class

5 days 15 Jul 2020

QA

  • Introduction and Software Testing
  • Software Test Life Cycle
  • Automation Testing and API Testing
  • Selenium framework development using Testing

Upcoming Class

-0 day 10 Jul 2020

Business Analyst

  • BA & Stakeholders Overview
  • BPMN, Requirement Elicitation
  • BA Tools & Design Documents
  • Enterprise Analysis, Agile & Scrum

Upcoming Class

4 days 14 Jul 2020

MS SQL Server

  • Introduction & Database Query
  • Programming, Indexes & System Functions
  • SSIS Package Development Procedures
  • SSRS Report Design

Upcoming Class

5 days 15 Jul 2020

Python

  • Features of Python
  • Python Editors and IDEs
  • Data types and Variables
  • Python File Operation

Upcoming Class

13 days 23 Jul 2020

Artificial Intelligence

  • Components of AI
  • Categories of Machine Learning
  • Recurrent Neural Networks
  • Recurrent Neural Networks

Upcoming Class

4 days 14 Jul 2020

Machine Learning

  • Introduction to Machine Learning & Python
  • Machine Learning: Supervised Learning
  • Machine Learning: Unsupervised Learning

Upcoming Class

7 days 17 Jul 2020

Tableau

  • Introduction to Tableau Desktop
  • Data Transformation Methods
  • Configuring tableau server
  • Integration with R & Hadoop

Upcoming Class

3 days 13 Jul 2020

Search Posts

Reset

Receive Latest Materials and Offers on AWS Course

Interviews