I have kitchen.yaml it creates ec2 instance dynamically ,when ever kitchen.yaml launches new instance I need to connect to secrets manager using instance profile, but I have to attach instance profile using chef recipe can anyone please suggest me how do I achieve this.
Asked
Active
Viewed 115 times
-2
-
1Please elaborate – Hernan Garcia Apr 14 '21 at 21:50
-
2In the subject you mention *IAM Role*, in the body you talk about *instance profile*. Those are two very different things. You may need to reword your question to clarify. Either way, the fact that you can't login to instance manually seems irrelevant – Felix Apr 14 '21 at 22:50
-
2Also it is a good idea to show the code you have written so far. In particular `kitchen.yaml` or any Chef recipe that you are running. – seshadri_c Apr 15 '21 at 05:37
1 Answers
1
not sure what you mean by "kitchen.yaml", and whether you use lunches instance (instead of launches) as pun - but quick google search gives the best result:
aws ec2 associate-iam-instance-profile
--iam-instance-profile <value>
--instance-id <value>
Obviously, you need to get the id of the instance that got launched (it's launched; not created)

Felix
- 9,248
- 10
- 57
- 89
-
thanks for the reply, but I can't login to instance manually so I have to attach through chef recipe any ideas, thanks – testdev Apr 14 '21 at 21:51
-
my answer does not require you to login to instance. You run it from command line *outside* the instance through AWS CLI. Are you familiar with AWS CLI? – Felix Apr 14 '21 at 22:45