There is an AWS EC2 instance which is launched by an auto-scaling-group. I wish to put this instance to Pending state during initialization.
This is very easy with the lifecycle hooks:
This hook will wait 3600 seconds before abandoning the instance.
I wish to call aws autoscaling complete-lifecycle-action
on the EC2 instance being initialized, however I always got:
Unable to locate credentials. You can configure credentials by running "aws configure".
Then I found out that I can create an IAM Role, which then I can attach to the EC2 instance, however that is not working either:
Role has been defined as below:
However when I choose the modify IAM role on a running instance:
How could I manage to send back the complete-lifecycle-action
from the EC2 instance with the easiest and most secure way? (I.e. I wish to give it a permission to only send back this message; I wish the role doesn't contain any permission for scaling in/out, modifying asg details, etc)