amazon-web-servicesaws-codebuild

AWS Codebuild error access denied to connection


I'm trying to create my webscraper project and I'm following this guide: "https://github.com/thejoeosborne/scheduled-scraper-example". I uploaded all the account ids and regions in my fork version of the repo and when I try to start build in Codebuild, I get the following error

Failed to get access token from arn:aws:codeconnections:eu-north-1:<account-id>:connection/6ea9d036-ab6b-4ca7-9524-7b7d221068b0: Access denied to connection arn:aws:codeconnections:eu-north-1:<account-id>:connection/6ea9d036-ab6b-4ca7-9524-7b7d221068b0

I cannot find any resource to troubleshoot this error. I'm guessing that I'm missing some permissions.


Solution

  • I was running into the same problem. Defining the following permissions on the service role linked to the CodeBuild project got me past the error:

    {
        "Version": "2012-10-17",
        "Statement": [
            {
                "Sid": "Statement1",
                "Effect": "Allow",
                "Action": [
                    "codeconnections:UseConnection",
                    "codeconnections:GetConnectionToken"
                ],
                "Resource": [
                    "arn:aws:codeconnections:<region>:<account-id>:connection/<connection-id>"
                ]
            }
        ]
    }