Complete the code to attach a managed policy to an IAM user.
aws iam attach-user-policy --user-name MyUser --policy-arn [1]Managed policies are referenced by their ARN. Inline policies are embedded directly and do not use ARNs.
Complete the code to create an inline policy for an IAM role.
aws iam put-role-policy --role-name MyRole --policy-name [1] --policy-document file://policy.jsonInline policies require a policy name, not an ARN.
Fix the error in the command to detach a managed policy from a user.
aws iam detach-user-policy --user-name MyUser --policy-arn [1]Detaching a managed policy requires the full ARN of the managed policy.
Fill both blanks to create and attach an inline policy to a user.
aws iam put-user-policy --user-name MyUser --policy-name [1] --policy-document [2]
Inline policies require a policy name and a policy document file path.
Fill all three blanks to list all managed policies and filter by scope.
aws iam list-policies --scope [1] --only-attached [2] --max-items [3]
To list AWS managed policies, use scope 'AWS'. The flag '--only-attached' expects 'true' or 'false'. 'max-items' limits the number of results.