1

When I create a mysql db via AWS console, I can control to which VPC the db instance lands.

enter image description here

However when i tried to use boto3 rds.create_db_instance to create a mysql db, the option is not available. At least I cannot see any VpcId parameter.

How can I set this value?

Anthony Kong
  • 3,288
  • 11
  • 57
  • 96

2 Answers2

0

You have to create something called a subnet group. This can be done with the same boto3 client via the create_db_subnet_group method. Use the name of the subnet group for the DBSubnetGroupName parameter on the create_db_instance method.

Evan Byrne
  • 101
  • 2
0

If you provide --db-subnet-group-name with rds.create_db_instance, it should use the vpc id from subnet group.

Meraj Rasool
  • 180
  • 1
  • 1
  • 7