AWS Elastic Compute Cloud (EC2)

Summary

In AWS, service you use to gain access to virtual servers (in AWS, all servers are virtual) is called EC2.

Using AWS EC2 instance is :
– Highly flexible
– Cost effective
– Quick

compared to using on-premises environment.
For starting Amazon EC2 AWS has already :
– built datacenters
– secured datacenters
– purchased servers
– installed servers
– made the servers online and ready to be used

All AWS customer has to do is request EC2 instances, and they launch and boot up, ready to be used within minutes. And you only pay for what you use, you pay only for running instances, not stopped or terminated instances. EC2 runs on top of physical host machines managed by AWS using virtualization technology. The hypervisor running on host machine is responsible for sharing underlying resources between virtual machines. The idea of sharing underlying hardware is called multitenancy. Hypervisor is also responsible for isolating virtual machines from each other as they are sharing the host’s resources.

When provisioning EC2 instance, you can :
– choose an operating system
– choose soft to run on the instance (internal business applications, simple or complex web apps, databases or third-party software)
– define memory and cpu of the instance (and resize it if needed)
– control the networking aspect of Amazon EC2


Each Amazon EC2 instance type is grouped under an instance family. When selecting an instance type, consider the specific needs for workloads and applications. Instance types offer varying combinations of CPU, memory, storage and networking capacity.
Different instance families in AWS are :
– general purpose (provide good balance of compute, memory and networking resources; can be used for diverse workloads, like web servers or code repositories)
– compute optimized (ideal for compute intensive tasks, like gaming servers, high performance computing, scientific modeling)
– memory optimized (good for memory intensive tasks, that prominently upload data in computer memory)
– accelerated computing (suitable for floating point number calculations, graphics processing or data pattern matching)
– storage optimized (ideal for workloads that require high performance for locally stored data)


Amazon EC2 Pricing

Amazon EC2 purchase options :
– on-demand (you only pay for the duration that instance runs for, no need for any prior contracts)
– savings plans (offers low prices for EC2 usage in exchange for a commitment to a consistent amount of usage, measured by dollars per hour, for a 1- or 3-year term ; this can save up to 72% on AWS compute usage – this can lower the price of EC2 usage regardles of type of EC2 instance, size, tenancy etc)
– reserved instances (suited for steady state workloads with predictable usage and offers you up to 75% discount versus on-demand pricing; 1- and 3-year term options are available). Payment options for reserved instances are :
    — full up-front (you pay for reserved instances in full when you commit)
    — partial up-front (you pay a portion when you commit)
    — no up-front (you don’t pay anything at the beginning)
– spot instances (allow to spare up to 90% versus on-demand price, important to note that workloads must be tolerant to being interrupted)
– dedicated hosts (physical hosts dedicated for your EC2, no one else will share the tenancy of that host)


Scalability and Elasticity

There are 2 ways of handle growing demands :
– scale up (add EC2 instances to serve the workload)
– scale out (reduce the number of EC2 instances serving the workload)

Elastic Load Balancing is AWS service that automatically distributes incoming application traffic across multiple resources, such as Amazon EC2 instances. Elastic Load Balancing is automatically scalable. Elastic Load Balancing is a regional construct, it distributes the traffic across EC2 instance located in different Availability Zones in the region


Messaging and Queuing

Messaging and queuing serves the approach known as “loosely coupled architecture”. According to “loosely coupled architecture”, one single failure does not lead to cascading failures. Messages sent from Application A to Application B are stored in a queue until they can be successfully delivered to Application B.

Amazon provides 2 Queue services :
– Simple Queue Service (SQS)
– Simple Notification Service (SNS)

Amazon SQS allows to :
– send
– receive
– store
messages between software components at any volume. Data contained within a message is called Payload

Amazon SNS allows to send notifications to end users. Amazon SNS topic is a channel for messages to be delivered. One message sent to a topic can fan out to multiple subscribers in a single “go”.


AWS offers multiple serverless compute options. Serverless means that AWS customer cannot see or access the underlying infrastructure (instances that are hosting your application).
AWS Lambda is a serverless compute option. Lambda service allows to upload your code in what is called a “Lambda function”. You configure a trigger, and then a service waits for a trigger. When a trigger is detected, the code is starting to run on a managed environment. Lambda is designed to run code under 15 minutes, and more suitable for a quick processes.

If you need access to the underlying environment, but still want efficiency and portability, you should look at AWS Container Services, like Amazon Elastic Container Service (Amazon ECS) or Amazon Elastic Kubernetes Service (Amazon EKS). Both of these services are Container Orchestration Tools. Orchestration Tools are created to help you manage your containers. ECS is designed to run your containerized applications at scale without the hassle of managing your own orchestration software. EKS does the same thing, but using different tooling and features.

Both Amazon ECS and EKS can run on top of EC2 instances that you manage. AWS Fargate is a serverless compute platform for ECS or EKS, can be used instead of EC2 instances to run ECS or EKS on top of.

 

Previous

Leave a Reply

Your email address will not be published. Required fields are marked *