I was trying to assume an IAM role with the AWS CLI, but I missed setting it up right in the prerequisites. Make sure to check that first, then move forward.
-
AWS CLI Setup: Ensure the AWS CLI is installed and configured with your credentials.
-
IAM Role Configuration: The role must exist with a trust policy allowing your user to assume it and appropriate permissions attached to it.
-
Permission Checks: Your IAM user or group must have sts: AssumeRole permission, and the role must have the necessary policies for the actions you need to perform.
Follow these steps to Assume an IAM Role:
-
To create your IAM policy, run the command and Make sure to replace policy.json with the path to your policy document. 
-
Find the ARN of the IAM role you want to use. It looks like this:



Replace <account-id> and <role-name> with your role's details and <session-name> with a name for your session (this can be any identifier).


