For the complete documentation index, see llms.txt. This page is also available as Markdown.

Overview

Configuring AWS EC2 auto scaling group for PostgreSQL

This section reviews how to configure an AWS EC2 instance for a PostgreSQL server. We will

  1. Create a security group that allows SSH and PostgreSQL server connections

  2. Create a launch template

  3. Create server using auto scaling group (recommended) OR single instance

  4. Attach an elastic IP address to our instance

Each of these subsections contains a video that walks through the instructions.

Why use AWS EC2 Auto Scaling over a single instance?

Auto-scaling adds or removes EC2 instances depending on changes in demand on the server. By using an auto scaling group, we can keep costs down by utilizing a smaller-sized instance (i.e 2 vCPUs) and adding instances when CPU usage increases.

AWS EC2 auto scaling allows you to

  • Assign a launch template to your auto scale group

    • A launch template is a saved pre-configuration of an instance that you can use to launch instances that have the same parameters

    • AWS uses your launch template to add instances you've previously configured when scaling out your application

      • Note: scaling out is when AWS adds instances when demand increases

  • Configure the minimum, maximum, and desired number of instances for your application

  • Prevent certain instances from being automatically terminated when scaling in

    • Note: scaling in is when AWS removes instances when demand decreases

  • Set a scaling policy that defines when instances should be added or removed from the group

References

Guides

(1) Research Documentation for Creating Jupyter Hub Server Using AWS, https://docs-jupyter.davidjachochavez.org/

(2) Better Programming (Medium), How to Provision a Cheap PostgreSQL Database in AWS EC2, https://medium.com/better-programming/how-to-provision-a-cheap-postgresql-database-in-aws-ec2-9984ff3ddaea

Documentations

(3) Amazon EC2 Instance Types, https://aws.amazon.com/ec2/instance-types/

(4) Amazon EC2 On-Demand Instance Pricing, https://aws.amazon.com/ec2/pricing/on-demand/

(5) Amazon Elastic Compute Cloud, Amazon EBS-optimized instances, https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-optimized.html

(6) AWS EC2 Auto Scaling User Guide, What is Amazon EC2 Auto Scaling?, https://docs.aws.amazon.com/autoscaling/ec2/userguide/what-is-amazon-ec2-auto-scaling.html

(7) Amazon EC2 Auto Scaling, Creating a launch template for an Auto Scaling Group, https://docs.aws.amazon.com/autoscaling/ec2/userguide/create-launch-template.html

(8) Amazon EC2 Auto Scaling, Health checks for Auto Scaling, https://docs.aws.amazon.com/autoscaling/ec2/userguide/healthcheck.html

(9) Amazon Elastic Compute Cloud, Status checks for your instance, https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/monitoring-system-instance-status-check.html

(10) Amazon EC2 Auto Scaling, Controlling which Auto Scaling instances terminate during scale in, https://docs.aws.amazon.com/autoscaling/ec2/userguide/as-instance-termination.html

(11) Amazon EC2 Auto Scaling, Target tracking scaling policies, https://docs.aws.amazon.com/autoscaling/ec2/userguide/as-scaling-target-tracking.html

Forums

(12) StackOverflow, What is the smallest AWS EC2 Instance I can run Postgres DB on?, https://stackoverflow.com/questions/61718959/what-is-the-smallest-aws-ec2-instance-i-can-run-a-postgres-db-on

(13) StackOverflow, How does the ARM architecture differ from x86?, https://stackoverflow.com/questions/14794460/how-does-the-arm-architecture-differ-from-x86

Last updated