compute resources pull and consume messages, processing them in a distributed fashion
Can be scaled with session affinity
Bind all the transactions of a session to a specific compute resource
Existing sessions do not directly benefit from the introduction of newly launched compute nodes
Instantiating Compute Resources
You can set up new EC2 instances with user data scripts and cloud-init directives
You can use simple scripts and configuration management tools such as Chef or Puppet
Can be used to launch EC2 instances, Amazon RDS DB instances, and Amazon Elastic Block Store (Amazon EBS) volumes
Results in faster start times and removes dependencies to configuration services or third-party repositories
Important in auto-scaled environments to quickly and reliably launch additional resources as a response to demand changes.
Docker—an open-source technology that allows you to build and deploy distributed applications inside software containers.
Launching from Docker image
Amazon Elastic Container Service (Amazon ECS) and AWS Fargate
Alternative container environment: Kubernetes and Amazon Elastic Container Service for Kubernetes (Amazon EKS)
Some parts are in a golden image, while others are configured dynamically through a bootstrapping action.
Infrastructure as Code
AWS CloudFormation templates give you an easy way to create and manage a collection of related AWS resources
provision and update them in an orderly and predictable fashion
CloudFormation templates can live with your application in your version control repository
Automation, Infrastructure Management, and Deployment
AWS CodeBuild, and AWS CodeDeploy support the automation of the deployment of these processes
AWS Elastic Beanstalk:
You can use this service to deploy and scale web applications and services developed with Java, .NET, PHP, Node.js, Python, Ruby, Go, and Docker on familiar servers such as Apache, Nginx, Passenger, and IIS. 17
Developers can simply upload their application code, and the service automatically handles all the details, such as resource provisioning, load balancing, auto scaling, and monitoring.
Amazon EC2 Recovery
Creating CloudWatch alarm that monitors EC2 instance and recover if impaired
AWS Systems Manager
You can automatically collect software inventory, apply OS patches, create a system image to configure Windows and Linux operating systems, and execute arbitrary commands.
You can maintain application availability and scale your Amazon EC2, Amazon DynamoDB, Amazon ECS, Amazon Elastic Container Service for Kubernetes (Amazon EKS) capacity up or down automatically according to the conditions you define
Alarms and Events
Amazon CloudWatch alarms
Amazon CloudWatch Events
AWS Lambda scheduled events
AWS WAF security automation
Services, Not Servers
Various components to interact with each other only through specific, technology-agnostic interfaces, such as RESTful APIs
Can modify the underlying implementation without affecting other components
Amazon API Gateway
Fully managed service that makes it easy for developers to create, publish, maintain, monitor, and secure APIs at any scale
Because each service can be running across multiple compute resources, there needs to be a way for each service to be addressed
EC2-hosted service, a simple way to achieve service discovery is through Elastic Load Balancing (ELB).
Because each load balancer gets its own hostname, you can consume a service through a stable endpoint.
Another form of loose coupling between services
One component generates events and another that consumes them
SQS, Amazon Kinesis, cascading Lambda events, AWS Step Functions, or Amazon Simple Workflow Service
Decouples components and introduces additional resiliency
Provide building blocks that developers can consume to power their applications
Can reduce the operational complexity of running applications. It is possible to build both event-driven and synchronous services for mobile, web, analytics, CDN business logic, and IoT without managing any server infrastructure. These architectures can reduce costs because you don’t have to manage or pay for underutilized servers, or provision redundant infrastructure to implement high availability.
If your application primarily indexes and queries data with no need for joins or complex transactions—especially if you expect a write throughput beyond the constraints of a single instance—consider a NoSQL database instead
If your schema cannot be denormalized and the application requires joins or complex transactions, RDBS should be considered
Large binary files should be stored in Amazon S3 with metadata in the database.
managed database services that offer enterprise performance at an open-source cost
AWS offers different database technologies based on your workload
RDBS (Relational Databases) can scale up by upgrading to a larger instance and can scale horizontally by adding more read replicas
Write capacity can be scaled horizontally by data partitioning or sharding. Data is split across multiple database schemas each running its own autonomous primary DB instance. RDS removes the operational overhead of running those instances, however, sharding introduces complexity in your application
combines transactional data from disparate sources to make them available for analysis and decision making
Amazon Redshift is a managed data warehouse service providing a scalable, highly available and cost-effective solution.
Searching enables datasets to be queried that are not precisely structured. AWS supports search services:
Amazon ElasticSearch (ES)
Uses graph structures for queries
The graph is defined as a consisting of edges (relationships), which directly relate to nodes (data entities) in the store.
Relationships allow faster retrieval of complex hierarchical structures in relational systems.
Managing Increasing Volumes of Data
Data lake architecture
Removing Single Points of Failure
When a resource fails, functionality is recovered on a secondary resource with the failover process. During the failover time, the resource remains unavailable.
Requests are distributed to multiple redundant compute resources. When one of them fails, the rest can simply absorb a larger share of the workload.
You should aim at automatic failure detection and reacting to failure. ELB, Route53 with health checks, ASGs and other methods will help you automatically recover from the failure.
Design Good Health Checks
Configuring the right health checks for your application helps determine your ability to respond correctly and promptly to a variety of failure scenarios. The health checks should reliably assess the health of the back-end nodes. Simple TCP check won’t detect the health state of a web server.
Durable Data Storage
The transaction is acknowledged only after being durably stored in both the primary location and its replicas. This will protect the integrity of data in the event of failure. In this case, the primary node is coupled with the replicas.
Decouples the primary node from the replica, however, introduces replication lag – used to horizontally scale the system’s read capacity for queries that can tolerate the replication lag.
Combines synchronous and asynchronous replication to overcome the challenges of large-scale distributed database systems. Replication to multiple nodes can be managed by defining the minimum number of nodes that must participate in a successful write operation.
Redis in AWS ElasticCache provide asynchronous communication – recent transactions can be lost in the event of a failover
RDS with Multi-AZ provides synchronous replication to keep data on the standby node up-to-date with the primary.
Automated Multi-Data Center Resilience
Disaster Recovery Plan
(Could consider failover to a distant second data center in the event of major disruption)
Low probability but huge impact risk
AZs provide a solution for short disruption, during which you
Fault Isolation and Traditional Horizontal Scaling
The measures above are insufficient if there is something harmful about the requests themselves.
Same scenarios which caused the failure of the primary instances could be replayed to fail the failover instances
Instances are grouped into shards
Each customer will be distributed to a specific shard
The impact is reduced in direct proportion with the number of shards
The client could try every endpoint in a set of sharded resources, until one succeeds, making the client fault tolerant
Optimize for Cost
Benchmarking may help in understanding the instance type and number of instances you require
Cost Optimization is an iterative process
Application and its usage will evolve over time
Autoscaling can help optimize the cost
Automate turning off production workloads when not in use
Replacing ec2 workloads with services
Take advantage of the variety of purchasing options
Application Data Caching
Amazon DynamoDB Accelerator (DAX)
Fully managed, highly available, in-memory cache for DynamoDB that delivers performance improvements from milliseconds to microseconds, for high throughput
Static content cached at Amazon CloudFront edge location
AWS WAF (Web Application Firewall)
Granular set of policies for access control of users
IAM roles can be assigned to instances to grant access to the resources
Data Encryption (in transit / at rest)
AWS is responsible for the security of underlying cloud infrastructure
You are responsible for securing the workloads you deploy to AWS
Allows client devices to access AWS resources through temporary tokens with fine-grained permissions