Tuesday, 17 May 2022

AWS RDS

Scale DB Storage

If auto scaling enabled, still need to meet condition below

  • Need to set max threshold
  • Free storage is 10% low
  • at least 5 minutes in this low storage state
  • 6 hours have passed since the last scalling

RDS Read replicas

It is for read only. It is async. The read replicas can be set up as multi AZ for Disaster Recovery. If master is not encryted, read replicas can not be encryted.

  • Up to 5 read replicas
  • Within the same AZ
  • Cross AZ
  • Cross regions

Sunday, 15 May 2022

AWS Application Load Balancer

You only need to expose the load balancer to the outside world. The load balancer then forwards requests to the EC2 instances or other services behind it. AWS provides different load balancers. Application load Balancer supports HTTP and HTTPS protocols.

ALB consists of these parts

  • Load balancer
  • Listener - it links to a target group. It sets up rules based on the port, protocol, query string etc to decide which target group to send
  • Target Group - it defines your group of backends

Wednesday, 11 May 2022

Amazon EC2

Security Group

Security group controls incoming and outcoming traffic to the resources which are associated with that security group such as your virtual machine, your database, or your load balancer with a firewall. It acts as a virtual firewall

  • A resource can associated with multiple security group
  • A security group can assigned to multiple resources
  • income source can be ip, and it can be security group

If get connection timeout,it may be caused by security group. Check the security group associated with that resource.

SSH to EC2 Instance

Connect to EC2 instance. Click the connect tab of that instance to find public ip address and user name. issue the below. That pem file is generated when you create the EC2 instance. When create a EC2 instance, it will ask if you want to generate key pair.

If key pair is lost, you can not recover it because AWS does not store a copy of it. If you can only find a private ip, it is inside a vpc. Therefore, need to vpn to that network and use private ip to connect.

//see bad permission. chmod 400 mykey.pem to fix it
ssh -i EC2-tutorial.pem ec2-user@54.189.138.151

IAM Role

We can attach a IAM role to instance. We can perform some actions after log into the instance based on permissions assigned to that IAM role. Never do aws config inside instance directly

  • To see RAM role attached, click security tab
  • To attache RAM role, select action drop down and select security option. Then choose Modify RAM role

Instance Types

  • General Purpose
  • Compute Optimized
  • Memory Optimized
  • Accelerated Computing
  • Storage Optimized ( great for workloads requiring high, sequential read/write access to large data sets on local storage)