chore: postgresql services file and rds commands

This commit is contained in:
Michele Cereda
2024-07-31 22:17:48 +02:00
parent 26388d6061
commit 9d9bc47df0
3 changed files with 27 additions and 0 deletions

View File

@@ -38,6 +38,14 @@ postgres.lan:5643:postgres:postgres:BananaORama
*:*:sales:elaine:modestPassword
EOF
chmod '600' ~/'.pgpass'
# Set up the per-user services file.
cat <<EOF > ~/'.pg_service.conf'
[prod]
host = prod.0123456789ab.eu-west-1.rds.amazonaws.com
port = 5433
user = master
EOF
```
```sh
@@ -51,6 +59,7 @@ psql 'my-db' 'user'
psql 'postgresql://host:5433/my-db?sslmode=require'
psql -U 'username' -d 'my-db' -h 'hostname' -p 'port' -W
psql --host 'host.fqnd' --port '5432' --username 'postgres' --database 'postgres' --password
psql "service=prod sslmode=require"
# List available databases.
psql … --list

View File

@@ -384,3 +384,10 @@
-r --no-role-passwords
changed_when: false
register: dump_execution
- name: Wait for pending changes to be applied
amazon.aws.rds_instance_info:
db_instance_identifier: "{{ db_instance_identifier }}"
register: instance_check
retries: 12
delay: 15
until: instance_check.instances[0].pending_modified_values.keys() | length > 0

View File

@@ -79,6 +79,17 @@ echo {1..5} | xargs -p -n '1' -I '{}' aws rds start-export-task …
aws rds describe-export-tasks --query 'ExportTasks[].WarningMessage' --output 'json'
aws rds restore-db-instance-to-point-in-time \
--source-db-instance-identifier 'awx' --target-db-instance-identifier 'awx-pitred' \
--restore-time '2024-07-31T09:29:40+00:00' \
--allocated-storage '20'
aws rds restore-db-instance-from-db-snapshot \
--db-instance-identifier 'awx-pitr-snapshot' \
--db-snapshot-identifier 'rds:awx-2024-07-30-14-15'
aws rds delete-db-instance --skip-final-snapshot --db-instance-identifier 'awx'
aws s3api list-buckets --output 'text' --query 'Buckets[].Name' | xargs -pn '1' aws s3api list-multipart-uploads --bucket
aws ec2 describe-volumes --output 'text' --filters 'Name=status,Values=available' \