connect mysql server installed on t1.micro instance from vpc t2.micro instance

Fatimah Wulandari asked:

I have mysql database server installed on ubuntu in t1.micro ec2 :

Instance state: running
Public IP: 50.xxx.xxx.xxx
Instance type: m1.medium
Elastic IP: 50.xxx.xxx.xxx
Private DNS: ip-xxx-xxx-xxx-xxx.us-west-1.compute.internal
Availability zone: us-west-1a

I create another instance, this one using t2.micro so it’s using vpc

Instance type: t2.micro
Elastic IP: 52.xxx.xxx.xxx
Private DNS: ip-xxx-xxx-xxx-xxx.us-west-1.compute.internal
Availability zone: us-west-1a
Private IPs: 17x.xxx.xxx.xxx
Security groups: default. view rules
Secondary private IPs: Scheduled events
No scheduled events
VPC ID: vpc-25xxxxxx
AMI ID: ubuntu-trusty-14.04-amd64-server-20150325 (ami-xxxxxxxx)
Subnet ID: subnet-9cxxxxxx
Platform

I’m deploying website in t2.micro and want to access mysql server in t1.micro. I’ve edited my.cnf configuration to comment #bind_address. In the t1.micro security group I’ve tried to add new inbound rule to access mysqlserver :

type : mysql
protocol : tcp
port : 3306
source : private ip of my t2.micro instance 17x.xxx.xxx.xxx.

My website could not access the server.

My answer:


You will need to set up ClassicLink to allow your classic EC2 instance to communicate with your new instance in the VPC.

This has two steps:

  1. Edit the VPC to enable ClassicLink. Click your VPC in the list of VPCs, select Actions, then Enable ClassicLink.

  2. Attach the classic instance to the VPC. Click your old instance in the list of instances, select Actions, ClassicLink, Link to VPC.


View the full question and answer on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.