How to set up Amazon MySQL RDS security group with EC2

You don’t want others to access your data, so a separate database security group for RDS should be setup. Only desired EC2 instances and yourself should be able to access RDS instance.

So, create a new security group, the inbound type of the db-sg should be MYSQL (Similar for other db), and source should be the security group of your EC2, e.g.: sg-ec2. Simply input ‘sg’ and select the correct one. Set this security group to RDS instance. Now only access from your EC2 instance security group will be allowed.

To access to the db, you need a EC2 instance in the security group sg-ec2 as described above. Then you can access your db via this ec2 instance.

You can administrate the database using GUI tool, like MySQL Workbench.

Open a new connection, choose TCP/IP Over SSH as connection method, input public EC2 instance DNS as SSH Host, input EC2 username and select private key. Enter RDS endpoint to MySQL HostNanme & Port, enter your db admin username and password, then you can access your db via EC2 instance.

image_pdf

Leave a Reply

Your email address will not be published. Required fields are marked *