File tree Expand file tree Collapse file tree 1 file changed +30
-13
lines changed Expand file tree Collapse file tree 1 file changed +30
-13
lines changed Original file line number Diff line number Diff line change @@ -69,12 +69,21 @@ That's it! Your PostgreSQL database will be backed up daily at 2 AM UTC.
6969 - Monthly backups transition to Glacier after 30 days
7070 - Yearly backups transition to Deep Archive after 90 days
7171
72- ## Manual Execution
72+ ## Manual Operations
7373
74- To manually trigger a backup:
74+ ** Trigger a backup:**
75+ ``` bash
76+ task invoke
77+ ```
78+
79+ ** View logs:**
80+ ``` bash
81+ task logs
82+ ```
7583
84+ ** Remove deployment:**
7685``` bash
77- serverless invoke -f backup
86+ task sls:remove
7887```
7988
8089## Monitoring
@@ -93,6 +102,23 @@ aws s3 ls s3://go-postgres-s3-backup-[stage]-backups/yearly/
93102aws s3 cp s3://go-postgres-s3-backup-[stage]-backups/daily/2025-08-01-backup.sql ./
94103```
95104
105+ ## Testing Backups Locally
106+
107+ ** Start local PostgreSQL:**
108+ ``` bash
109+ docker run --name my-postgres -e POSTGRES_PASSWORD=postgres -d -p 5432:5432 postgres
110+ ```
111+
112+ ** Restore backup to local instance:**
113+ ``` bash
114+ docker exec -i my-postgres psql -U postgres -d postgres -W < [backup-file].sql
115+ ```
116+
117+ ** Connect and query:**
118+ ``` bash
119+ docker exec -it my-postgres psql -U postgres
120+ ```
121+
96122## Environment Variables
97123
98124| Variable | Description | Required |
@@ -134,18 +160,9 @@ Ensure your PostgreSQL database allows connections from AWS Lambda:
134160
135161Check the Lambda logs for errors:
136162``` bash
137- serverless logs -f backup --tail
138- ```
139-
140- ## Remove Deployment
141-
142- To remove all AWS resources:
143-
144- ``` bash
145- serverless remove --stage production
163+ task logs
146164```
147165
148- ** Warning** : This will delete the S3 bucket and all backups. Download any backups you want to keep first.
149166
150167## License
151168
You can’t perform that action at this time.
0 commit comments