Module 2 - Compute in the Cloud Flashcards
Amazon Elastic Compute Cloud (Amazon EC2)
• Provides secure, resizable compute capacity in the cloud as Amazon EC2 instances.
Traditional on-premises resources
o Spend money upfront to purchase hardware.
o Wait for servers to be delivered to you.
o Install the servers in your physical data centre.
o Make all the necessary configurations.
Amazon EC2 instance you can use virtual server to run applications in AWS Cloud
o You can provision and launch an Amazon EC2 instance within minutes.
o You can stop using it when you have finished running a workload.
o You pay only for the compute time you use when an instance is running, not when it is stopped or terminated.
o You can save costs by paying only for server capacity that you need or want.
How Amazon EC2 Works
Launch
Connect
Use
Launch
- Launch an instance.
- Begin by selecting a template with basic configurations for your instance.
- Configurations include operating system, application server, or applications.
- Also select instance type – specific hardware configuration of your instance.
- Preparing to launch an instance – specific security settings to control network traffic that can flow into and out of your instance.
Connect
- Connect to the instance.
- Can be done in several ways.
- Your programs and applications have multiple different methods to connect directly to the instance and exchange data.
- Users can also connect to instance by logging in and accessing the computer desktop.
Use
- After connecting to instance, you can begin using it.
* Can run commands to install software, add storage, copy and organise files, and more.
Amazon EC2 instance types
General purpose instances
Compute optimised instances
Memory optimised instances
Accelerated computing instances
Storage optimised instances
General purpose instances
provide a balance of compute, memory, and networking resources.
• Can use them for variety of workloads: o Application servers. o Gaming servers. o Backend servers for enterprise applications. o Small and medium databases.
- Resource needs for compute, memory, and networking roughly equivalent.
- Running it on general purpose instance because application does not require optimisation in any single resource area.
Compute optimised instances
– ideal for compute-bound applications that benefit from high-performance processors.
• Can use compute optimised instances for workloads e.g. web, application and gaming servers.
- Different is ideal for high-performance web servers, compute-intensive applications servers, and dedicated gaming servers.
- Use for batch processing workloads that require processing many transactions in a single group.
Memory optimised instances
designed to deliver fast performance for workloads that process large datasets in memory.
• Memory – temporary storage area.
• Holds all data and instructions that a central processing unit (CPU) needs to be able to complete actions.
• Before computer program/application able to run – loaded from storage into memory.
• Preloading process gives CPU direct access to computer program.
• Memory optimised instances enable you to run workloads with high memory needs and receive great performance.
Accelerated computing instances
use hardware accelerators/coprocessors to perform some functions more efficiently than is possible in software running on CPUs.
- E.g. floating-point number calculations, graphics processing, data pattern matching.
- Hardware accelerator – component that can expedite data processing.
- Accelerated computing instances ideal for workloads e.g. graphics applications, game streaming, application streaming.
Storage optimised instances
– designed for workloads require high, sequential read and write access to large datasets on local storage.
• E.g. distributed file systems, data warehousing applications, high-frequency online transaction processing (OLTP) systems.
• Input/output operations per second (IOPS) is metric that measures performance of storage device.
o Indicates how many different input or output operations device can perform in one second.
o Storage optimised instances designed to deliver tens of thousands of low-latency, random IOPS to applications.
o Input operations – data put into a system e.g. records entered into database.
o Output operation – data generated by server e.g. analytics performed on records in database.
o Application has high IOPS requirement – storage optimised instance provide better performance over other instance types not optimised for this kind of use case.
Amazon EC2 Pricing
On-Demand instances
Amazon EC2 savings plans
Reserved instances
Spot instances
Dedicated hosts
On-demand instances
short-term, irregular workloads that cannot be interrupted.
No upfront costs or minimum contracts apply.
Instances run continuously until you stop them.
Only pay for only compute time you use.
Developing and testing applications and running applications that have unpredictable usage patterns.
Not recommended for workloads that last a year or longer – these workloads can experience greater cost savings using Reserved Instances.
Amazon EC2 Savings Plans
Enable you to reduce your compute costs by committing to consistent amount of compute usage for 1-year or 3-year term.
Term commitment results in savings of up to 72% over On-Demand costs.
Any usage up to the commitment is charged at the discounted Savings Plan rate.
Any usage beyond the commitment is charged at regular On-Demand rates.
Reserved instances
billing discount applied to use of On-Demand Instances in your account.
Can purchase Standard Reserved and Convertible Reserved Instances for 1-year or 3-year term.
• Scheduled Reserved Instances for a 1-year term.
• Realise greater cost savings with 3-year option.
End of Reserve Instance term – continue using Amazon EC2 instance without interruption.
Charged On-Demand rates until you do one of the following:
• Terminate the instance.
• Purchase a new Reserved Instance that matches the instance attributes (instance type, Region, tenancy, and platform).
Spot instances
– ideal for workloads with flexible start and end times or can withstand interruptions.
Use unused Amazon EC2 computing capacity.
Offer cost savings at up to 90% of On-Demand prices.
Start and stop processing job without affecting overall operations of your business.
Make Spot request and Amazon EC2 capacity available – Spot Instance launches.
Make Spot request and Amazon EC2 capacity unavailable – request not successful until capacity becomes available.
Unavailable capacity might delay launch of background processing job.
After launched Spot Instance – capacity no longer available or demand for Spot Instances increases, instance may be interrupted.
• Might not post any issues for job.
Developing and testing applications – most likely want to avoid unexpected interruptions.
Choose different EC2 instance type that is ideal for those tasks.
Dedicated hosts
physical servers with Amazon EC2 instance capacity that is fully dedicated to your use.
Can use existing per-socket, per-core, or per-VM software licenses to help maintain license compliance.
Can purchase On-Demand Dedicated Hosts and Dedicated Hosts Reservations.
Dedicated Hosts most expensive.
Scalability
- Involves beginning with only the resources you need and designing your architecture to automatically respond to changing demand by scaling out or in.
- Pay for only the resources you use.
- Don’t have to worry about lack of computing capacity to meet your customers’ needs.
- Amazon EC2 Auto Scaling - scaling process to happen automatically
Amazon EC2 Auto Scaling
- Enables you to automatically add or remove Amazon EC2 instances in response to changing application demand.
- Automatically scaling your instances in and out as needed – maintain greater sense of application availability.
Amazon EC2 Auto Scaling two approaches
Dynamic scaling
Predictive scaling
*to scale faster - use dynamic and predictive scaling together
Dynamic scaling
responds to changing demand
Predictive scaling
automatically schedules the right number of Amazon EC2 instances based on predicted demand
Minimum capacity (first configuration)
number of Amazon EC2 instances that launch immediately after you have created Auto Scaling group.
second configuration
desired capacity
third configuration
maximum capacity
Elastic load balancing
• AWS service that automatically distributes incoming application traffic across multiple resources such as Amazon EC2 instances.
Load balancer
acts as single point of contact for all incoming web traffic to your Auto Scaling group.
- Add/remove Amazon EC2 instances in response to the amount of incoming traffic – requests route to load balancer first.
- Requests spread across multiple resources that will handle them.
Low-demand period
- Few registers open – matches demand of customers who need service.
- Less likely to have open registers with no customers.
High-demand period
- Number of customers increases – coffee shop opens more registers to accommodate them.
- Load balancer – directing customers to most appropriate register so number of requests can evenly distribute across open registers.
Monolithic application
o Approach to application architecture – single component fails, other components fail and possibly the entire application fails.
Microservices approach
application components loosely coupled.
o Single component fails – other components continue to work because they are communicating with each other.
o Loose coupling prevents entire application from failing.
o Can take microservices approach with services and components that fulfil different functions.
two services facilitate application integration
Amazon Simple Notification Service (Amazon SNS)
Amazon Simple Queue Service (Amazon SQS)
Amazon Simple Notification Service (Amazon SNS)
- Publish/subscribe service.
- Using Amazon SNS topics – publisher publishes messages to subscribers.
- Subscribers can be web servers, email addresses, AWS Lambda functions, several other options.
Amazon Simple Queue Service (Amazon SQS)
- Message queuing service.
- Can send, store, and receive messages between software components, without losing messages or requiring other services to be available.
- Application sends messages into queue.
- User or service retrieves message from queue, processes it, and then deletes it from queue.
Serverless Computing
• Amazon EC2 – service that lets you run virtual servers in the cloud.
• Applications that you want to run in Amazon EC2, must do the following:
o Provision instances (virtual servers).
o Upload your code.
o Continue to manage the instances while your application is running.
• “serverless” means your code runs on servers, but you do not need to provision or manage these servers.
• Serverless computing – can focus more on innovating new products and features instead of maintaining servers.
• Flexibility to scale serverless applications automatically.
• Can adjust applications’ capacity by modifying the units of consumptions e.g. throughput and memory.
• AWS service for serverless computing is AWS Lambda.
AWS Lambda
- Service that lets you run code without needing to provision or manage servers.
- You only pay for the compute time that you consume.
- Charges apply only when your code is running.
- Also run code for virtually any type of application or backend service, all with zero administration.
How AWS Lambda Works
- You upload your code to Lambda.
- You set your code to trigger from an event source, such as AWS services, mobile applications, or HTTP endpoints.
- Lambda runs your code only when triggered.
- You pay only for the compute time that you use.
Containers
- In AWS, you can also build and run containerised applications.
- Containers provide you with a standard way to package your application’s code and dependencies into single object.
- Use containers for processes and workflows in which there are essential requirements for security, reliability and scalability.
Amazon Elastic Container Service (Amazon ECS)
- Highly scalable, high-performance container management system that enables you to run and scale containerised applications on AWS.
- Supports Docker containers.
- Docker – software platform that enables you to build, test and deploy applications quickly.
- AWS supports use of open-source Docker Community Edition and subscription-based Docker Enterprise Edition.
- With Amazon ECS, can use API calls to launch and stop Docker-enabled applications.
Amazon Elastic Kubernetes Service (Amazon EKS)
- Fully managed service that you can use to run Kubernetes on AWS.
- Kubernetes – open-source software that enables you to deploy and manage containerised applications at scale.
- Large community of volunteers maintains Kubernetes.
- AWS actively works together with Kubernetes community.
- New features and functionalities release for Kubernetes applications, can easily apply these new updates to your applications managed by Amazon EKS.
AWS Fargate
- Serverless compute engine for containers.
- Works with both Amazon ECS and Amazon EKS.
- Do not need to provision or manage servers.
- AWS Fargate manages server infrastructure for you.
- Focus more on innovating and developing your applications.
- Pay only for resources that are required to run your containers.