AWS learning common Issues

188 阅读2分钟

Introduction

Here listed the common issues i faced when developing or deploying based on AWS.

Issue List

1. Failed to connect AWS aurora from local

Backgroud

I setup a vpc and created a aurora cluster within the vpc. But when i connected from local via MYSQL workbeach, it showed me "Failed to connect ..."

Root cause

When creating aurora, it will create subnet group if not existed in a vpc, actually i have created several subnet but they are all private subnet. So subnet group will resuse these subnet, and since they are all private, so you can't access from local

Solution

The solution is very easy. We just need add a internet gateway to the VPC in which your aurora cluster is existed.Locate to VPC dashboard page, in the left panel

  1. Add an internet gateway if not existed, in my case it is named "my-internet-gateway". Then click "Action" at the upper-right, select "Attach to VPC", now you can select the vpc your aurora cluster is in.

  2. Create an route table if not existed, in my case, it's named "my-route". Then type your vpc id to and click "create" button.

  3. Since the route and internet gateway are ready, it's time to add the internet gateway to the route. Click "Route Tables" in left menu, and select the route you just created, it will show the detail information. Click "Route" -> "Edit routes", add below route

Destination          Target
0.0.0.0/0            igw-0a8d88c5e8fe2587f
  1. Make sure your aurora cluster port is in allowed in vpc security group as below Click "Security group" in left menu, click and review the each group that referenced by aurora cluster to make sure in the "Inbound" tab below entity is existed
Type            Protocol    Port range    Source    Description - optional–
MYSQL/Aurora	TCP	    3306	  0.0.0.0/0

Follow above four steps if should connect aurora successfully

Note: 1. If you still face the issue, please check if your auraro "public accessable" option is enabled. If not, modify each instance of cluster.

Note: 2. During changing "public accessable" to enabled, you may face another issue like "We are sorry, to mofify..., since the DNS hostnames or resolution...". It means you didn't enable vpc DNS host names and resolution. Then you can select the vpc ,and click "Action" -> "Edit Hostnames",and check "Enable". Repeat the same step for "Edit Resolution"

Note: 3. If all above steps are performed, but still doest't work. Please make sure your input correct host name in your client tool. In other words, please DO NOT use the value of "Endpoint name" column in "Endpoints" list. You should click each instance, then use "Endpoint" in "Connectivity & security" tab