How do I add inbound security rules for EC2 using

2019-07-13 06:09发布

问题:

I am using appery.io, and I need to whitelist it's app server as shown in this tutorial using my database hosted on Amazon RDS.

How do I do that using it's DNS? i.e.

aex1.appery.io
aex2.appery.io

I know I can do that using it's IP address. However, I would like to use it's DNS to protect against IP address changes.

回答1:

From what I know and from trying out on aws console and the VPC documentation: http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_SecurityGroups.html

you can only specify IP.

Only other way I can think of is: Place a service in the same VPC as your DB. Make it to periodically check for any changes in the IP of the url you pasted. If it changes, then it should update the rules accordingly. To allow it to access AWS API, you need to give the instance it is running on with required permissions. Read about instance profiles. You need to create the required role using IAM and then assign the corresponding instance profile to your instance when launching the instance. Your code should run on that instance and it will have required permission based on the role you created.

You can run this program outside aws as well. But give it access to access_key and secretkey, region and set right role for that user.