I’m very new to Amazon cloudformation technique. I’m trying to launch an ec2 instance along with the IAM roles.
I have cloudformation script for this. But the problem I face is the IAM roles and Ec2 instances are created, but they aren’t tied with each other.
I did create the IAM-roles using AWS::IAM::Role and AWS::IAM::InstanceProfile.
Is there any other command that I should use?
Thanks in advance.
The easiest way to solve such problems is to use CloudFormer. CloudFormer is a tool that creates a starting point template from the AWS resources you already have running in your environment.
Once you have launched Cloud Former, you will get a web interface (check the URL in the Output section of the launched stack), that will be able to describe all your resources in a specific region. It will lead you through which resources you wish in each category (DNS, Network, Compute…). At the end you can see the template and copy it, or save it in S3.
But if you wish to do it manually, you need to add the
AWS::IAM::InstanceProfileyou created to thePropertiesofAWS::EC2::InstanceasIamInstanceProfileSee more details on
AWS::EC2::Instancehere