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

**URL:** <https://forum.serverless.com/t/fail-to-deploy-the-cloudformation-template-is-invalid-s3-error-unable-to-get-the-object/6376>\
**Category:** Serverless Framework\
**Created:** [November 6, 2018, 6:31pm UTC](https://forum.serverless.com/t/fail-to-deploy-the-cloudformation-template-is-invalid-s3-error-unable-to-get-the-object/6376 "2018-11-06T18:31:57Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![KanesYang](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.serverless.com/kanesyang/32/3087_2.png) [@KanesYang](https://forum.serverless.com/u/KanesYang)\
**Post date:** [November 6, 2018, 6:31pm UTC](https://forum.serverless.com/t/fail-to-deploy-the-cloudformation-template-is-invalid-s3-error-unable-to-get-the-object/6376/1 "2018-11-06T18:31:57Z")

</div>

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](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.

---

<div class="post-metadata">

**Author:** ![naing](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.serverless.com/naing/32/1919_2.png) [@naing](https://forum.serverless.com/u/naing)\
**Post date:** [November 6, 2018, 10:33pm UTC](https://forum.serverless.com/t/fail-to-deploy-the-cloudformation-template-is-invalid-s3-error-unable-to-get-the-object/6376/2 "2018-11-06T22:33:00Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![KanesYang](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.serverless.com/kanesyang/32/3087_2.png) [@KanesYang](https://forum.serverless.com/u/KanesYang)\
**Post date:** [November 7, 2018, 3:07pm UTC](https://forum.serverless.com/t/fail-to-deploy-the-cloudformation-template-is-invalid-s3-error-unable-to-get-the-object/6376/3 "2018-11-07T15:07:37Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![codemonkey](https://avatars.discourse-cdn.com/v4/letter/c/9fc348/32.png) [@codemonkey](https://forum.serverless.com/u/codemonkey)\
**Post date:** [November 20, 2018, 9:50am UTC](https://forum.serverless.com/t/fail-to-deploy-the-cloudformation-template-is-invalid-s3-error-unable-to-get-the-object/6376/4 "2018-11-20T09:50:47Z")

</div>

I just ran into this issue, same here, [s3.amazonaws.com](http://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.
