Armless Framework and CodeBuild: Missing required "Bucket" key in parameters
I am having trouble building AWS CodeBuild to build and deploy a project built with Serverless Framework .
Here's the story so far.
Initialize the project
I followed the docs to create a serverless project start and leave it "as is" - basically, "Hello World".
Then I pushed the project to the git repository.
Testing Deployment Using the CLI
Then from the CLI I called ...
serverless deploy
... and as expected, the lambda was unwrapped. A good start.
CodeBuild
Next on the agenda was moving on to build and deploy using AWS CodeBuild.
I added the file buildspec.yml
to the root of the project:
version: 0.1
phases:
install:
commands:
- npm install
- npm install -g serverless
- echo install done
build:
commands:
- serverless deploy
- echo build done
Then, using the AWS Console / Web Interface, I defined a code build project that links to the git repo.
In doing so, AWS has created an IAM role with the following policy:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Resource": [
"arn:aws:logs:eu-west-1:************:log-group:/aws/codebuild/my-api-build",
"arn:aws:logs:eu-west-1:************:log-group:/aws/codebuild/my-api-build:*"
],
"Action": [
"logs:CreateLogGroup",
"logs:CreateLogStream",
"logs:PutLogEvents"
]
},
{
"Effect": "Allow",
"Resource": [
"arn:aws:s3:::codepipeline-eu-west-1-*"
],
"Action": [
"s3:PutObject",
"s3:GetObject",
"s3:GetObjectVersion"
]
},
{
"Effect": "Allow",
"Resource": [
"arn:aws:s3:::my-api-artifacts/*"
],
"Action": [
"s3:PutObject"
]
}
]
}
Do it...
So, I clicked "Start Build" in the CodeBuild project and got the following errors:
Error 1:
ServerlessError: User: arn:aws:sts::************:assumed-role/codebuild-my-api-build-service-role/AWSCodeBuild-********-****-****-****-************ is not authorized to perform: cloudformation:DescribeStackResources on resource: arn:aws:cloudformation:eu-west-1:************:stack/my-api-development/*
which I "fixed" by adding the following to the policy created with the build code ...
{
"Effect": "Allow",
"Resource": [
"arn:aws:cloudformation:eu-west-1:*"
],
"Action": [
"cloudformation:*"
]
}
Error 2:
By clicking the "Start assembly again" button and getting:
An error occurred while provisioning your stack: ServerlessDeploymentBucket - API: s3:CreateBucket Access Denied.
which I "fixed" by adding the following to the policy created with the build code ...
{
"Effect": "Allow",
"Resource": [
"arn:aws:cloudformation:eu-west-1:*"
],
"Action": [
"cloudformation:*"
]
}
Error 3:
Serverless Error ---------------------------------------
Missing required key 'Bucket' in params
Finally: My actual question (s)
- What does it mean
Missing required key 'Bucket' in params
? Where should I be looking? - Are my "fixes" for errors 1 and 2 OK? I am a Bit AWS and therefore an IAM newbie, so I am not sure about editing policies.
source to share