Adding Spot Instances to the Security Group of an RDS Instance

若如初见. 提交于 2020-07-22 21:40:15

问题


I have an RDS MySQL persistant instance, and I am trying to run spot instances which are created once every 8 hours and then destroyed.

The issue I am having is that I don't understand how can I add those spot instances which have dynamic IPs to the security group of my RDS Instance in order to let them perform queries,etc.

Should I grab the IP as soon as the spot instance is created and the add it to the security group of the RDS instance each time a new spot instances is created? Also destroy it every time the spot instance is terminated?

Any tip on what approach to take will be much appreciated! Thanks!


回答1:


Assuming that both your spot instances and RDS are in the same region: when setting up an RDS security group, you can also allow machines in EC2 security groups to connect to your RDS machine. Simply add all your spot instances to a EC2 security group and grant access to RDS for this security group.

If your RDS and spot instances are in different regions, you could use the AWS API or an AWS API client like boto for Python to add the IPs automatically.



来源:https://stackoverflow.com/questions/12252862/adding-spot-instances-to-the-security-group-of-an-rds-instance

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!