Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AWS policy generation facing syntax error?

If I add this policy

{
    "Version": "2012-10-17",
    "Statement": [
        {
        "Effect": "Allow",
        "Principal": {
            "AWS": "arn:aws:iam::xxxxxxxxxxxx:user/stikbook-dev"
        },
        "Action": "sts:AssumeRole"
    }
    ]
}

I'm facing this error

[Ln 4, Col 8Missing Resource: Add a Resource or NotResource element to the policy statement. Learn more
Ln 6, Col 21 Unsupported Principal: The policy type IDENTITY_POLICY does not support the Principal element. Remove the Principal element. Learn more ]

What resource that I want to add? and "unsupported policy"?

like image 384
Cyril I Avatar asked Nov 15 '25 12:11

Cyril I


1 Answers

You are generating a trust policy. But it seems that what you want is to create a user managed or inline policy. They have different purpose then trust policy. I guess your policy should look like the following:

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "VisualEditor0",
            "Effect": "Allow",
            "Action": "sts:AssumeRole",
            "Resource": "*"
        }
    ]
}

where * can be replaced by a specific ARN of IAM role to be assumed.

like image 108
Marcin Avatar answered Nov 18 '25 06:11

Marcin



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!