aws-amplify / aws-amplify/amplify-cli

bucket already exists when calling `amplify init`

Open
#12,727 1 comment 0 reactions 0 assignees View on GitHub
bug ops-deploy p3
Dominant language
TypeScript
Stars
2.9k
Forks
825
Avg merge
11d 23h
Merged PRs (30d)
2

Description

### How did you install the Amplify CLI?

npm

### If applicable, what version of Node.js are you using?

v14.19.1

### Amplify CLI Version

12

### What operating system are you using?

Mac

### Did you make any manual changes to the cloud resources managed by Amplify? Please describe the changes made.

No

### Describe the bug

When running `amplify init`, sometimes observe an error like "amplify-test-staging-194222-deployment already exists"

![Screen Shot 2023-04-12 at 12 54 22 PM](https://github.com/aws-amplify/amplify-cli/assets/4824042/4bb1ddd7-08d8-46a0-ade7-05efc133534e)

This is referring to the s3 bucket name created to hold amplify app resources.

It seems like the generated bucket name of `amplify-{appName}-{envName}-{randomNumber}-deployment" is not random enough and is sometimes already used by another bucket. It succeeds when I retry the `amplify init` command.

If it's possible to make the {randomNumber} section more random to reduce likelihood of naming collisions, that would prevent the issue.

### Expected behavior

`amplify init` should always succeed without conflicting resource names

### Reproduction steps

`amplify init`, but it's not a reliable reproduction

### Project Identifier

_No response_

### Log output

```
# Put your logs below this line

```

### Additional information

_No response_

### Before submitting, please confirm:

- [X] I have done my best to include a minimal, self-contained set of instructions for consistently reproducing the issue.
- [X] I have removed any sensitive information from my code snippets and submission.

Contributor guide

Open the contributing guide

Research direction

Start with the amplify init entry point and investigate how the deployment bucket name is generated, using repeated initialization attempts to observe collisions. Done means amplify init reliably avoids an existing bucket name and succeeds without requiring a retry.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, typescript
Domain
cli, cloud
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.