I am new to aws.
I have a third party service running on an instance. The service uses a few different ports. When there is a need to restart the service some of the ports change randomly even though the ports are pre defined in the service's config. This quirky behaviour is not in my control. I end up updating the security group with the changed port values manually every time there is a restart. I have to update as quickly as possible because connected user's might be blocked out.
I understand it is possible to programmatically change security groups using the aws sdk. I would like to automate this for the instance running the service. So basically have some script which restarts the service, checks the new port values and sets up the security group from within the instance. My questions are:
- Is it possible to do this from within the running instance?
- Or maybe from another aws instance?
- If it is possible are there any potential pitfalls ?
- Are their any other ways to achieve this automation?
thanks for the help.