amazon-web-servicescommand-line-interfaceaws-policiesaws-roles

Unable to create an AWS role in a specific PATH CLI


My user has a policy that allows him to iam:CreateRole and iam:DeleteRole but when I launch this command :

aws iam create-role --role-name MyRole --path /projects/ --assume-role-policy-document file://MyRoleTrust.json

But I have this error :

An error occcured (ValidationError) when calling the CreateRole operation: The specified value for path is invalid.It must begin and end with / and contain only alphanumeric characters and / or / characters.

But I have policies using this condition with this type of arn : "arn:aws:iam::<account-id>:role/projects/*". It means that this /projects/* should exist.

So why do I get this error...I'm a bit confused. Thanks for you replies.


Solution

  • Looks like you are using Windows as your OS. And command line tool is a something like Git for Windows with bash emulation.

    Same bug is mentioned in GitHub. The problem is that mingw trying to be smart, and converting paths

    Here are three possible solutions:

    1. Set variable MSYS_NO_PATHCONV=1 to disable path conversions
    2. Use escaped /projects/ parameter by adding extra / (//projects/)
    3. Remove Windows at all (the best one)