- Newest
- Most votes
- Most comments
To reduce the number of Aurora Serverless instances and import an existing Aurora Serverless PostgreSQL database into a new stack, you can follow these steps:
-
Create a new stack for your Aurora Serverless PostgreSQL database:
- Use AWS CloudFormation or your preferred Infrastructure as Code (IaC) tool to define the new stack.
- Include the Aurora Serverless PostgreSQL database resource in your stack definition.
-
Export the existing database:
- Use AWS Database Migration Service (DMS) or native PostgreSQL tools to export your existing database schema and data.
-
Import the database into the new stack:
- Once your new Aurora Serverless PostgreSQL database is created in the new stack, import the exported data and schema.
-
Import the secret:
- Use AWS Secrets Manager to manage your database credentials.
- In your new stack, create a new secret or import the existing secret that contains the database credentials.
-
Update your application stack:
- Modify your application stack to reference the new Aurora Serverless PostgreSQL database in the new stack.
- Update any necessary connection strings or environment variables to point to the new database.
-
Test and validate:
- Ensure your application works correctly with the imported database in the new stack.
-
Decommission the old database:
- Once everything is working as expected, you can safely remove the old Aurora Serverless instance.
When creating the new Aurora Serverless PostgreSQL database in your stack, you can use AWS CLI or AWS Management Console. For example, using AWS CLI:
aws rds create-db-cluster \
--db-cluster-identifier your-new-cluster-name \
--engine aurora-postgresql \
--engine-version 13.9 \
--engine-mode serverless \
--scaling-configuration MinCapacity=2,MaxCapacity=64,AutoPause=true,SecondsUntilAutoPause=1000 \
--master-username your-username \
--master-user-password your-password
Remember to adjust the parameters such as engine version, scaling configuration, and credentials according to your specific requirements.
By following this approach, you can consolidate your Aurora Serverless PostgreSQL databases into a single stack, reducing the number of instances and improving manageability.
Sources
Creating an Aurora Serverless v1 DB cluster - Amazon Aurora
Serverless Database - Amazon Aurora Serverless - AWS
Relevant content
- asked a year ago
- asked 5 months ago
- AWS OFFICIALUpdated 3 years ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 2 years ago