patternMinor
Choose security group for restore-db-instance-to-point-in-time
Viewed 0 times
grouppointchoosetimeinstancesecurityforrestore
Problem
When using the AWS CLI restore-db-instance-to-point-in-time command, I can't figure out how to set the security group. The doc on this page says:
The target database is created from the source database with the same configuration as the original database except that the DB instance is created with the default DB security group.
Is it possible to override this parameter to use the same security group as the original instance?
The target database is created from the source database with the same configuration as the original database except that the DB instance is created with the default DB security group.
Is it possible to override this parameter to use the same security group as the original instance?
Solution
Not without an additional API call. You will need to wait for the target database to move to an "available" state and then use modify-db-instance with the target database and security group as parameters.
Here's some pseudocode based off of a similar example I have in Powershell. Selecting information from describe-db-instances will vary by which language you're using the API with, but by default it looks like it comes back as JSON.
Here's some pseudocode based off of a similar example I have in Powershell. Selecting information from describe-db-instances will vary by which language you're using the API with, but by default it looks like it comes back as JSON.
restore-db-instance-to-point-in-time --source-db-instance-identifier sourceDatabase --target-db-instance-identifier targetDatabase
while(targetinstance not "available")
{
targetinstance = describe-db-instances --db-instance-identifier targetDatabase
sleep for X seconds
}
modify-db-instance --db-instance-identifier targetInstance --db-security-groups mySecurityGroupCode Snippets
restore-db-instance-to-point-in-time --source-db-instance-identifier sourceDatabase --target-db-instance-identifier targetDatabase
while(targetinstance not "available")
{
targetinstance = describe-db-instances --db-instance-identifier targetDatabase
sleep for X seconds
}
modify-db-instance --db-instance-identifier targetInstance --db-security-groups mySecurityGroupContext
StackExchange Database Administrators Q#49910, answer score: 3
Revisions (0)
No revisions yet.