Fail to deploy: The CloudFormation template is invalid: S3 error: Unable to get the object

when I running

> sls deploy --verbose

I encounter the problem like

Serverless: Split stack started…
Serverless: Uploading CloudFormation file to S3…logStack.json
Serverless: Uploading CloudFormation file to S3…apiStack.json
Serverless: Uploading CloudFormation file to S3…permissionStack.json
Serverless: Uploading CloudFormation file to S3…
Serverless: Uploading artifacts…
Serverless: Uploading service .zip file to S3 (20.81 MB)…
Serverless: Validating template…
Serverless: Uploading CloudFormation file to S3…
Serverless: Uploading artifacts…
Serverless: Uploading service .zip file to S3 (20.81 MB)…
Serverless: Validating template…

The CloudFormation template is invalid: S3 error: Unable to get the object https://s3.amazonaws.com/folderName.../compiled-cloudformation-template.json

For debugging logs, run again after setting the “SLS_DEBUG=*” environment variable.

Your Environment Information -----------------------------
OS: linux
Node Version: 8.9.4
Serverless Version: 1.27.3

One thing raised my attention, from the log message before the error message, the compiled-cloudformation-template.json should be in the URL start with s3.us-west-2.amazonaws rather than s3.amazonaws

Is this the issue that leads to the s3 error. If so, how could I fix it? If not, what is the real problem (this is not the first time I deployed, and I have several successful experiences before).

Appreciate to help of any kinds.

hi
Its not clear where the problem is by the amount of info you have provided,
pls provide more info, you can run with SLS_DEBUG=* and also the template file is its possible.

Thanks, but I have fixed this issue. It is because the some restriction of my AWS account. After I got the admin authority, this problem got solved.

I just ran into this issue, same here, s3.amazonaws.com instead of s3-eu-west-1.
aws s3 ls was listing all buckets properly
I refreshed my authentication token and then it worked again.

1 Like