question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

sam deploy --guided errors with "S3 Bucket does not exist"

See original GitHub issue

Description

Using sam deploy --guided, the process fails with “Error: S3 Bucket does not exist.”

Steps to reproduce

  1. A developer deployed this stack using sam deploy --guided --template-file realtime.yaml.
  2. Output: Deploying with following values =============================== Stack name : askAroundMe-realtime Region : us-east-1 Confirm changeset : False Deployment s3 bucket : aws-sam-cli-managed-default-samclisourcebucket-kll3li4nzc9r Capabilities : [“CAPABILITY_IAM”] Parameter overrides : {}

Initiating deployment

Error: S3 Bucket does not exist.

Provide steps to replicate.

The developer has also renamed the template to template.yaml to avoid the template parameter, with the same result. Then tried after deleting the toml file with the same result.

Observed result

sam deploy –guided Deploying with following values

    Stack name                 : askAroundMe-realtime
    Region                     : us-east-1
    Confirm changeset          : False
    Deployment s3 bucket       : aws-sam-cli-managed-default-samclisourcebucket-kll3li4nzc9r
    Capabilities               : ["CAPABILITY_IAM"]
    Parameter overrides        : {}

Initiating deployment

Error: S3 Bucket does not exist.

Expected result

The sam deployment should create a deployment bucket and complete.

Additional environment details (Ex: Windows, Mac, Amazon Linux etc)

  1. OS:
  2. sam --version:

Add --debug flag to command you are running

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:13 (2 by maintainers)

github_iconTop GitHub Comments

14reactions
sagarpatkecommented, Jun 21, 2020

In addition to the bucket, a sam deployment also creates two cloudformation stacks. One for keeping track of SAM CLI resources, and the other to track the app’s resources. Try deleting these as well.

6reactions
Nxtracommented, Oct 31, 2020

The sam deploy --guided process looks for a CloudFormation stack, rather than the bucket, to decide whether or not to create a new bucket (S3 API doesn’t give us a good way to search by tags, for example, and since S3 bucket names need to be globally unique this is the approach we need to take). If you’re going to delete the S3 bucket, you’ll also need to delete the associated stack.

You can, of course, always provide your own S3 bucket via samconfig.toml or as a parameter to deployments.

Given that this was filed on another developer’s behalf, I think the question would be what the contents of the aws-sam-cli-managed-default template are, and if there is a bucket present there and this error persists, please reopen this issue. Otherwise, delete the stack and re-run.

Okay I see. This is what happened to me:

  • I previously deployed resources using sam
  • I cleaned up my s3 buckets in my account and removed the bucket managed by the cloudformation stack of sam
  • The cloudformation stack still existed. However, the bucket that was in the stack was deleted
  • When using sam deploy --guided it told me it had found the necessary resources for deployment. Meaning, it found the stack
  • However I couldn’t deploy the stack. It gave me an unrelated error message, for example: Unable to upload artifact hello_world/ referenced by CodeUri parameter of HelloWorldFunction resource.
  • I deleted the sam deployment stack that originally contained the bucket
  • I ran sam deploy --guided. This recreated the sam deployment bucket and deploy worked.
Read more comments on GitHub >

github_iconTop Results From Across the Web

sam deploy - AWS Serverless Application Model
--resolve-s3, Automatically create an Amazon S3 bucket to use for packaging and deploying for non-guided deployments. If you specify the --guided option, then ......
Read more >
Why S3 bucket is not getting created though it is mentioned in ...
Deploying AWS Lambda functions through AWS CloudFormation requires an Amazon Simple Storage Service (Amazon S3) bucket for the Lambda deployment ...
Read more >
Tutorial: Deploying a Hello World application - 亚马逊云科技
This means that you are using an earlier version of the Amazon SAM CLI that does not support the --guided parameter. To fix...
Read more >
SAM CLI Deployment error creating S3 Bucket - AWS re:Post
I'm trying to deploy the hello world app created with Quarkus following the guide ... I've also tried to pre-create the S3 bucket...
Read more >
AWS SAM CLI Cheatsheet!. A quick cheat sheet for your friend…
sam deploy --guided → Deploy your application. $ sam local start-api → Host your ... sam validate → Verifies whether an AWS SAM...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found