# AWS Certified Solutions Architect - Associate (HA)
###### tags: `AWS`
## HA Architecture
### Load balancer
#### Types
- Application Load Balancer
Best suited for load balancing of HTTP and HTTPS traffic. They operate at Layer 7 and are application-aware.
- Network Load Balancer
Best suited for load balancing of TCP traffic where extremem performance is required. They operate at Layer 4 and are ultra -low latencies.
- Classic Load Balancer
Legacy Elastic Load balancers. You can load balance Layer 7 or Layer 4
> If your application stops responding, the ELB responds with 504 error.
Tips:
- If you need the IPv4 address of your end user, look for the **X-Forwarded-For** header
- Instances monitored by ELB are reported as: InService, or OutofService
- Health Checks check the instance health by talking to it.
- Load Balances have their own DNS name. You are never given an IP address.
- Read **FAQ**
### Advanced Load balancer
#### Sticky Sessions
CLB routes each request independently to the registered EC2 instance with the smallest load.
> Sticky sessions allow you to bind a user's session to a specific EC2 instance (This ensures that all requests from the user during the session are sent to the same instance)

#### With Cross Zone Load Balancing vs Without



#### Path Patterns
You can create a listener with rules to forward requests based on the URL path. This is known as path-based routing. For example, you can route general requests to one target group and requests to render images to another target group.

### Auto scaling

#### Components
- Group
- Configuration Templates
- Scaling Options
#### Scaling options
- Maintain current instance levels at all times
Maintain a specified number of running instances at all times
- Scale manually
You specify only the change in the maximum, minimum, or desired capacity of your Auto Scaling group.
- Scale based on a schedule
Scaling actions are performed automatically as a function of time and date
- Scale based on demand
Lets you define parameters that control the scaling process(CPU utiliztion)
- Use predictive scaling
### HA Archietecture

Scenario: You have a website that requires a minimum of 6 instances and it must be highly available. You must also be able to tolerate the failure of 1 AZ. What is the idea architecture for this environment while also being the most cost effective?
- 2 AZ with 2 instances in each AZ
- 3 AZ with 3 instances in each AZ
- 1 AZ with 6 instances in each AZ
- 3 AZ with 2 instances in each AZ
**Remember the following**
- Always Design for failure
- Use Multiple AZ's and Regions where ever you can.
- Know the difference between Multi-AZ and Read Replicas for RDS.
- Know the difference between scaling out and scaling up.
- Read the question carefully and always consider the cost element.
- Know the different S3 storage classes
### Network Diagram for HA

### CloudFormation
- Is a way of completely scripting your cloud environment
- Quick Start is a bunch of CloudFormation templates already built by AWS Solutions Architects allowing you to create complex environments very quickly.
### Elastic beanstalk
With Elastic beanstalk, you can quickly deploy and manage applications in the AWS Cloud without worrying about the infrastructure that runs those applications. You simply upload your application, and Elastic Beanstalk automatically handles the details of capacity provisioning, load balancing, scaling, and application health monitoring.
### HA Bastions

- Scenario 1

(ELB is expensive, and too many instances)
- Scenario 2

Tips:
**HA with Bastion Hosts**
- Two hosts in two separate AZ. Use a Network Load Balancer with static IP addresses and health checks to fail over from one host to the other.
- Can't use an Application Load Balancer, as it is layer 7 and you need to use layer 4.
- One host in one AZ behind an Auto scaling group with health checks and a fixed EIP. If the host fails, the health check will fail and th Auto Scaling group will provision a new EV2 instance in a separate AZ. You can use a user data script to provision the same EIP to the new host. This is the cheapest option, but it is not 100% fault tolerant.
### On-Premises Services
with AWS
- [x] Database Migration Service (DMS)
- Allows you to move DB to and from AWS
- Might have your DR env in AWS and your on-premises env as your primary
- Works with most popular DB, such as Oracle, MySQL, DynamoDB, etc.
- Supports homogenous/heterogeneous migrations.
- [x] Server Migration Service (SMS)
- SMS supports incremental replicarion of your on-premises servers in to AWS
- Can be used as a backup tool, multi-site strategy (on-premises and off-premises), and a DR tool.
- [x] AWS Application Discovery Service
- AWS Application Discovery Service helps enterprise customers plan migration projects by gathering information about their on-premises data centers.
- [x] VM Import/Export
- Migrate existing applications in to EC2.
- Can be used to create a DR strategy on AWS or use AWS as a second site.
- You can also use it to export your AWS VMs to your on-premises data center.
- [x] Download Amazon Linux 2 as an ISO
Tips:
5 services.