aws-amplify / aws-amplify/amplify-cli
bucket already exists when calling `amplify init`
- 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"

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
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