Amazon Web Services (AWS) - Create IAM Profiles using the AWS CLI

by
Jeremy Canfield |
Updated: April 15 2024
| Amazon Web Services (AWS) articles
This assumes you have already configured the aws command line tool. If not, check out my article on Getting Started with the AWS CLI.
- An IAM Policy allows certain actions (such create) on certain resources (such as EC2)
- An IAM User is typically a users account (such as john.doe) that contains an IAM Identity-Based Policy that allows certain actions (such as list) on certain resources (such S3)
- An IAM Role contains an IAM Policy that allows certain actions (such create) on certain resources (such as EC2). Let's say the Identity-Based Policy attached to john.doe does NOT allow "create S3"
- The Role that allows "create S3" could be attached to john.doe - or, john.doe could Assume the Role:
- Often, a Role will have two Policies:
The aws iam create-instance-profile command can be used to create a new profile. In this example, a profile named my-profile will be created.
aws iam create-instance-profile --instance-profile-name my-profile
Often, then the aws iam add-role-to-instance-profile command is used to attach a role to the profile.
aws iam add-role-to-instance-profile --role-name my-role --instance-profile-name my-profile
Did you find this article helpful?
If so, consider buying me a coffee over at