-
Notifications
You must be signed in to change notification settings - Fork 2
Setup AWS EC2 instance to connect to RDS Postgres Database
Ian Liu edited this page Sep 27, 2024
·
3 revisions
- Go to the AWS console: https://oidc.gov.bc.ca/auth/realms/umafubc9/protocol/saml/clients/amazon-aws, for Forest Client API dev project, click “Login to Console” (if want to setup the instance and connection for test and prod, go to the AWS console for test and prod)
- In the console home, search for “EC2” service
- On the EC2 page, in the left menu, click on “Instances”, it will show a list of running instances
- Create a new EC2 instance by clicking on “Launch instances”
- name: whatever
- instance type: could be t2.micro or t2.nano
- keypair: no need this time
- network setting: select “Select existing security group”, in the dropdown, select “App_sg”. Could select “Web_sg” as well, but maybe no need
- and then launch instance
- In the instance list, pick the instance by click on its “Instance ID”
- Once in the Linux shell, install the postgres
sudo yum update
-
sudo yum install postgresql
Note: If got the error says "Unable to find a match: postgresql", could run a search to see which postgres package is availableyum search postgresql
, and then pick one from the list, for examplesudo yum install postgresql15.x86_64
- Connect to the RDS Postgres Database:
psql -h dev-fam-cluster-one.cp9oqzf51oiq.ca-central-1.rds.amazonaws.com -p 5432 -U fam_proxy_api famdb
- hostname could be found by
- searching “RDS” service
- select “Database” from the left menu
- select the cluster with role read or writer instance depending on purpose
- the endpoint is the hostname
- database name could be found at the same place, under “Configuration” tab -> “DB name”
- username “fam_proxy_api” is safer than the admin account
- hostname could be found by
- Enter the password, the password could be found by
- searching “Secret Manager” service
- select secret name “famdb-api-creds-easy-manatee”
- in the secret value section, click “Retrieve secret value”
- Environment Management
- Release Management
- Creating a Release
- Database Backups and Restores
- OIDC Client Testing
- FAM Onboarding Ops Guide
- Setup AWS CloudWatch
- Setup AWS EC2 instance to connect to RDS Postgres Database
- Technical Troubleshooting
- Managing Terraform State
- Enable Cloudwatch Logs for API Gateway
- Update AWS CloudFront Certificate
- Verify IDIM BCeID Client SOAP Web Service