问题
When rebuilding an elastic beanstalk environment, EB automatically recreates a new and associated RDS instance.
Once associated, RDS instances cannot be dissociated from an EB environment.
I have a snapshot of the previous RDS prior to the rebuild.
You cannot restore RDS snapshots to an existing RDS instance.
How then, can I rebuild the environment with my desired snapshot attached? Or, how can I use my existing snapshot, or how can I migrate the existing snapshot data to the new database (I tried a data export with create schema's but lacked permissions on the import). Any appropriate but ideally simple option will do.
回答1:
If you have a snapshot of your RDS DB, you can create a new environment with it. For this, you need to specify the DBSnapshotIdentifier option setting.
- Create a file
.ebextensions/rds_builder.config
in the root of your project Add the following:
option_settings: aws:rds:dbinstance: DBSnapshotIdentifier: <snapshot ID here>
EDIT:
You can also create a new environment using a saved configuration template of the present one. It is likely that this saved template will contain information in the aws:rds:dbinstance
(since you have associated your present environment with an RDS), so you would need to basically modify this bit to point to your snapshot. This should work, and is probably the better approach.
来源:https://stackoverflow.com/questions/49224288/restoring-an-elastic-beanstalk-rds