Amazon Elastic Compute Cloud (Amazon EC2) provides secure, resizable compute capacity in the cloud as Amazon EC2 instances.
When you spin up an EC2 instance, you aren’t necessarily taking an entire host to yourself. Instead, you are sharing the host with multiple other instances, otherwise known as virtual machines. And a hypervisor running on the host machine is responsible for sharing the underlying physical resources between the virtual machines. This idea of sharing underlying hardware is called multitenancy.
EC2 instances are resizable. You might start with a small instance, but at some point you can give that instance more memory and more CPU. This is what we call vertically scaling an instance.
Some benefits of using Amazon EC2 include:
If you have an application in which the resource needs for compute, memory, and networking are roughly equivalent, you might consider running it on a general purpose instance because the application does not require optimization in any single resource area.
Ideal for compute-intensive tasks like gaming servers, high performance computing or HPC, and even scientific modeling.
Memory optimized instances are designed to deliver fast performance for workloads that process large datasets in memory.
Accelerated computing instances use hardware accelerators, or coprocessors, to perform some functions more efficiently than is possible in software running on CPUs.
Examples of these functions include floating-point number calculations, graphics processing, and data pattern matching. Accelerated computing instances are ideal for workloads such as graphics applications, game streaming, and application streaming.
Use cases: developing and testing applications and running applications that have unpredictable usage patterns. Not recommended for workloads that last a year or longer.
This term commitment results in savings of up to 72% over On-Demand costs.
You can purchase Standard Reserved and Convertible Reserved Instances for a 1-year or 3-year term, and Scheduled Reserved Instances for a 1-year term.
Spot Instances use unused Amazon EC2 computing capacity and offer you cost savings at up to 90% off of On-Demand prices.
You can use your existing per-socket, per-core, or per-VM software licenses to help maintain license compliance.
You can purchase On-Demand Dedicated Hosts and Dedicated Hosts Reservations.
Scalability involves beginning with only the resources you need and designing your architecture to automatically respond to changing demand by scaling out or in.
If you want the scaling process to happen automatically, the AWS service that provides this functionality for Amazon EC2 instances is Amazon EC2 Auto Scaling.
Amazon EC2 Auto Scaling enables you to automatically add or remove Amazon EC2 instances in response to changing application demand. It also ensures high availability.
Scaling out (horizontal scaling) is when you add more instances to your Auto Scaling Group and scaling in is when you reduce the number of instances in your Auto Scaling Group.
Within Amazon EC2 Auto Scaling, you can use two approaches: dynamic scaling and predictive scaling.
Dynamic scaling responds to changing demand.
Predictive scaling automatically schedules the right number of Amazon EC2 instances based on predicted demand.
When you create an Auto Scaling group, you can set the minimum number of Amazon EC2 instances.
A load balancer is an application that takes in requests and routes them to the instances to be processed.
Elastic Load Balancing is the AWS service that automatically distributes incoming application traffic across multiple resources.
Elastic Load Balancing runs at the Region level rather than on individual EC2 instances.
If you have an app with tightly coupled components, this type of architecture can be considered a monolithic application.
In this approach to application architecture, if a single component fails, other components fail, and possibly the entire application fails.
In a microservices approach, application components are loosely coupled.
In this case, if a single component fails, the other components continue to work because they are communicating with each other.
Two services facilitate application integration:
Amazon Simple Notification Service (Amazon SNS) is a publish/subscribe service.
Using Amazon SNS topics, a publisher publishes messages to subscribers.Subscribers can be web servers, email addresses, AWS Lambda functions…
It is possible for subscribers to subscribe to a single topic or to multiple topics.
Amazon Simple Queue Service (Amazon SQS) is a message queuing service.
Using Amazon SQS, you can send, store, and receive messages between software components, without losing messages or requiring other services to be available.
In Amazon SQS, an application sends messages into a queue. A user or service retrieves a message from the queue, processes it, and then deletes it from the queue.
The term “serverless” means that your code runs on servers, but you do not need to provision or manage these servers.
Serverless means that you cannot actually see or access the underlying infrastructure or instances that are hosting your application.
Another benefit of serverless computing is the flexibility to scale serverless applications automatically.
AWS Lambda is a service that lets you run code without needing to provision or manage servers.
AWS Lambda is a service that allows you to upload your code into what’s called a Lambda function. Configure a trigger and from there, the service waits for the trigger. When the trigger is detected, the code is automatically run in a managed environment.
Containers provide you with a standard way to package your application’s code and dependencies into a single object.
Container orchestration services help you to deploy, manage, and scale your containerized applications.
Amazon Elastic Container Service (Amazon ECS) is a highly scalable, high-performance container management system that enables you to run and scale containerized applications on AWS.
Amazon ECS supports Docker containers.
AWS supports the use of open-source Docker Community Edition and subscription-based Docker Enterprise Edition.
Amazon Elastic Kubernetes Service (Amazon EKS) is a fully managed service that you can use to run Kubernetes on AWS.
Kubernetes is open-source software that enables you to deploy and manage containerized applications at scale.
AWS Fargate is a serverless compute engine for containers. It works with both Amazon ECS and Amazon EKS.
When using AWS Fargate, you do not need to provision or manage servers.