Skip to content

instance access

0

there is ec2 running in different vpc this ec2 needs access to dbs running in different vpc db has db sg attached in same vpc dms also deployed it has dms sg which can access to dbs also in vpc where ec2 is deployed also has redshift it has dms sg as source allowed for 5439 port dbs are mysql,postgres,documentdb so on ec2 which ports to be opened to access dbs can same dms sg used like redshift?

  • You are using multiple VPCs? Are these VPCs connected in some way like transit gateway, VPC peering or Cloud WAN. If not, it won't work.

asked 10 months ago172 views

1 Answer
1

For EC2 to access databases in a different VPC:

Required ports (inbound on database security groups):

MySQL: 3306 PostgreSQL: 5432 DocumentDB: 27017 Security Group Configuration Options:

Option 1: Add the EC2's security group as a source on the database security groups for the respective ports. This is the recommended approach for proper security separation.

Option 2: Attach the DMS security group to your EC2 instance as an additional security group. Since your databases already allow inbound from DMS SG, the EC2 would inherit that access. This follows the same pattern as your Redshift setup.

Option 2 is simpler but Option 1 provides better security isolation between migration and application workloads.

Network prerequisites:

VPC Peering or Transit Gateway configured Route tables updated in both VPCs NACLs allowing traffic (if using custom NACLs) Additional resources:

https://docs.aws.amazon.com/vpc/latest/userguide/security-group-rules-reference.html

https://docs.aws.amazon.com/vpc/latest/userguide/working-with-security-groups.html

https://docs.aws.amazon.com/vpc/latest/peering/what-is-vpc-peering.html

https://docs.aws.amazon.com/vpc/latest/tgw/what-is-transit-gateway.html

https://docs.aws.amazon.com/vpc/latest/peering/working-with-vpc-peering.html

answered 10 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.