Hugo
Hugo

Reputation: 1672

Getting Error InvalidInputException: CodeBuild is not authorized to perform: sts:AssumeRole on arn:aws:iam::xxxxxxxx:role/MYROLE when creating project

I am getting this error when using AWS javascript SDK to create a project in codebuild

Getting Error InvalidInputException: CodeBuild is not authorized to perform: sts:AssumeRole on arn:aws:iam::xxxxxxxx:role/MYROLE when creating project

The role I'm using has attached the following default AWS policies:

and the following trust relationship configuration:

{
"Version": "2012-10-17",
"Statement": [
    {
        "Effect": "Allow",
        "Principal": {
            "Service": "codebuild.amazonaws.com"
        },
        "Action": "sts:AssumeRole"
    }
]}

Am I missing something? Is is possible to create a codebuild project from JS SDK? Does someone can show me an example? I followed this documentation and tried many things i found about policies, roles, etc but I've been stuck here for some days already.

Thanks in advance ;)

Upvotes: 0

Views: 1172

Answers (1)

Yang Liu
Yang Liu

Reputation: 751

Your trust relationship configuration is correct. Mine is the same as yours, and it works for me.

I think the problem you are seeing maybe similar to this: https://stackoverflow.com/a/60217010/9785462.

You may want to try create the IAM role first, and then the CodeBuild.

Upvotes: 1

Related Questions