Reputation: 11164
I tried to create a S3 bucket(thisIsTestBucket190) via AWS SDK (Node) and came across Invalid bucket name exception.
{ InvalidBucketName: The specified bucket is not valid.
at Request.extractError (/Users/niro273/Desktop/data-lake/node_modules/aws-sdk/lib/services/s3.js:577:35)
at Request.callListeners (/Users/niro273/Desktop/data-lake/node_modules/aws-sdk/lib/sequential_executor.js:105:20)
at Request.emit (/Users/niro273/Desktop/data-lake/node_modules/aws-sdk/lib/sequential_executor.js:77:10)
at Request.emit (/Users/niro273/Desktop/data-lake/node_modules/aws-sdk/lib/request.js:683:14)
at Request.transition (/Users/niro273/Desktop/data-lake/node_modules/aws-sdk/lib/request.js:22:10)
at AcceptorStateMachine.runTo (/Users/niro273/Desktop/data-lake/node_modules/aws-sdk/lib/state_machine.js:14:12)
at /Users/niro273/Desktop/data-lake/node_modules/aws-sdk/lib/state_machine.js:26:10
at Request.<anonymous> (/Users/niro273/Desktop/data-lake/node_modules/aws-sdk/lib/request.js:38:9)
at Request.<anonymous> (/Users/niro273/Desktop/data-lake/node_modules/aws-sdk/lib/request.js:685:12)
at Request.callListeners (/Users/niro273/Desktop/data-lake/node_modules/aws-sdk/lib/sequential_executor.js:115:18)
message: 'The specified bucket is not valid.',
code: 'InvalidBucketName',
region: null,
time: 2018-03-29T04:51:02.692Z,
requestId: '5D487CF96846EFE2',
extendedRequestId: '1TzPeOv4c7zq+H+GV5kFMFO3Y6awoS79VCuf4C7lUmy/IucNEfbINEfEIiNp/Esz7t38ckYZbrU=',
cfId: undefined,
statusCode: 400,
retryable: false,
retryDelay: 34.88207359966853 }
Would be great if I could know what is the root cause.
Upvotes: 25
Views: 69919
Reputation: 2960
I had this error when trying to create a lambda code using aws-cdk
It turned out that the region I set was wrong. So, the bucket being used to upload the source for the lambda was wrong.
The solution was as simple as change the region value.
Upvotes: 1
Reputation: 99
It's all about name convention!
The bucket name can be between 3 and 63 characters long, and can contain only lower-case characters, numbers, periods, and dashes.
Upvotes: 8
Reputation: 11164
AWS provides naming standards when naming an aws bucket.
The bucket name can be between 3 and 63 characters long, and can contain only lower-case characters, numbers, periods, and dashes.
Each label in the bucket name must start with a lowercase letter or number.
The bucket name cannot contain underscores, end with a dash, have consecutive periods, or use dashes adjacent to periods.
The bucket name cannot be formatted as an IP address (198.51.100.24).
The name provided contains upper case letters, by switching to lower case letters the issue can be resolved.
Upvotes: 57