Part 2. Learn about AWS at once - ELB, ASG, RDS, Aurora, ElastiCache

· Tech· Cloud
CloudCertification

Scalability & Availability

  • Vertical Scalability - t2.micro > t2.large
  • Horizontal Scalability - distributed system
  • High Availability - more than 2 AZ

ELB

ALB, NLB, GWLB, Sticky Sessions A load balancer serves to distribute the load of traffic coming from multiple servers. It is connected to several AWS services and provides integrated functions such as EC2, ECS auto-scaling, CloudWatch, and Route53.

  • The request is forwarded to the instance that responds properly with a health check.
  • ELB Type - CLB (deprecated), ALB, NLB, GWLB
  • provide static DNS name we can use in our application

ELB Types

Screenshot 2024-12-13 at 4 19 05PM

ALB

ALB has a fixed hostname, and since the application does not communicate directly with the client, the IP is not known to the client. However, it passes the actual client's IP by putting X-Forwarded-For in the header.

  • By setting up a Listener Rule, you can write what kind of response will be sent as an Action for a specific request. ELB
Target Group

In ALB, you can set and use a Target Group, and this Target Group can be an EC2 instance, ECS task, Lambda functions, or IP.

  • Specify Target Group according to URL Path, Hostname, Http Headers, and QueryString.

NLB

Network load balancers are applied to communications using high-performance TCP and UDP traffic. It uses one static IP per availability zone and does not apply to Free Tier.

GWLB

Lower layer communication uses IP packets. You must use the GENEVE protocol (port 6081).

Sticky Sessions

Cookies allow users to send requests to the same instance each time they make a request. The advantage of using Sticky Sessions is that an instance does not lose a user's session data until the cookie expires. -Application-Based Cookies

  • Cookies created by target are set inside the application.
  • The cookie created by the load balancer has the name AWSALBAPP. -Duration-Based Cookies
  • It is created by a load balancer and has the names AWSALB and AWSELB.

Cross-Zone Load Balancing

The same traffic can be distributed to all instances regardless of AZ. If Cross-Zone Load Balancing is not used, distribution occurs proportional to the number of instances in each Availability Zone depending on the request.

  • Because Cross-Zone Load Balancing is enabled by default in ALB, there is no charge for inter AZ data.
  • Cross-Zone Load Balancing is disabled by default in other load balancers.

###SSL/TLS SSL makes an encrypted connection at the socket layer, but TLS is a new version of SSL that makes an encrypted connection at the transport layer. TLS is mostly used, but in practice it is expressed as SSL in most cases.

  • The load balancer uses X.509 certifiacate.
  • Can be managed through ACM (Amazon Certificate Manager).
  • SNI (Server Name Indication) enables SSL processing on multiple websites. Not supported by CLB.

Auto Scaling Group

Settings for scale out can be made using ASG. Allows replacement and increase of instances. When using a load balancer, if the connected instance health check determines that the instance is not normal, the instance can be replaced according to ASG settings.

  • You can use Launch Template to set AMI, EC2 User data, EBS, ELB, etc.
  • With Scaling Policies, you can set policies such as adding instances based on CPU usage.
  • With Target Tracking Policy, you can specify settings for an average number of connections.
  • Scaling Cooldowns have a default value of 300sec.
  • Even if usage exceeds the CPU standard according to the policy, the set maximum capacity is not increased.
  • You can set scale-out based on CloudWatch notifications.

Database

RDS, Aurora, ElastiCache Audit logs from RDS and Aurora can be transferred to CloudWatch and stored for a longer period of time. ###RDS Relational databases include MySQL, PostgreSQL, MariaDB, Oracle, MS SQL Server, and Amazon Aurora.

  • Provides continuous backup and restoration.
  • Monitoring is also provided, but SSH is not available.
  • Provides Auto Scaling.
  • Read Replica can be used to read as a replica or to replace the original DB.
  • Up to 15 Read Replicas
  • Costs are incurred when data needs to be moved to another AZ, but no separate network costs are incurred based on the same AZ.
  • If you enable Multi-AZ in the modification, the original RDS will be changed to Multi-AZ using the snapshot function.

Aurora

Supported by high-performance RDS compatible with Postgres and MySQL. Aurora is said to provide 5x the throughput of MySQL and 3x the throughput of PostgreSQL.

  • Have up to 15 Read Replicas.
  • Cost is higher than RDS.
  • In Aurora DB Cluster, you can connect to Master DB as Writer Endpoint and Reader DB as Reader Endpoint.

RDS Proxy

RDS Proxy can be used in RDS and Aurora, which increases database efficiency by connecting to a proxy rather than directly to the database. And it reduces the failover time of RDS and Aurora. IAM authentication and security management are enabled by AWS Secret Manager. Additionally, RDS Proxy is secure because it can only connect to your VPC.

ElastiCache

When a cache hit occurs, data is pulled directly from ElastiCache, and when a cache miss occurs, data is pulled from the database. And then the cache is stored in ElastiCache again. This has the advantage of reducing the load because it can be checked with ElastiCache without directly querying the database, and allowing data to be retrieved more quickly for frequently viewed data.

  • Redis can create replicated databases in multi-AZ. It also supports data persistence using Append-On-File (AOF) persistence.
  • Memcached can manage data by sharding it across multiple nodes. There is no data persistence and does not provide high availability using replication. Supports multi-threading.
  • For reference, there is also Amazon MemoryDB that provides in-memory high performance using the Redis-compatible API.
  • 5 Read Replicas you can add in an ElastiCache Redis Cluster with Cluster-Mode-Disabled
  • Read Replica uses Asynchronous Replication and Multi-AZ uses Synchronous Replication

ElastiCache Strategy

  • Is caching a good idea?
  • Is there security in place?
  • Is data designed for caching?
  • Which caching model to use?
lazy loading / cache aside / lazy population

In the case of a cache miss, it is read from RDS and written to the cache again, and in this process, a user experience that appears to be lazy loading may occur.

write through

When writing data, it means writing to both RDS and cache. Since data may not match RDS and cache, a lazy loading strategy can also be used. The disadvantage is that many caches may be created that will not be read.

cache evictions and ttl

You can explicitly delete the cache or have cache that is older than a certain period of time be deleted.

Comments

No comments yet. Be the first!

    164 posts in 테크

    15 / 164