1 Answer
- Newest
- Most votes
- Most comments
1
While I haven't seen this particular problem there is a high chance that this is a timing issue. It would be very easy to write code which creates something (target group in this case) and then tries to use that something (here, register targets with the target group) before the service control plane has had time to react.
Rather than just add a delay what I would do is query the service to see if the target group has been successfully created. If it hasn't, then wait (say, for a second) and try again. You might even perform an exponential backoff in that loop and have some condition for permanent failure (just in case).
There's an excellent article about this in the Amazon Builder's Library.
Relevant content
- asked 6 months ago
- asked 5 years ago
- AWS OFFICIALUpdated 9 months ago
- AWS OFFICIALUpdated 2 years ago
- How do I update a CloudFormation stack that's failing because of a resource that I manually deleted?AWS OFFICIALUpdated 3 years ago
Thanks for this. I will give it a try.