I am doing my first steps with AWS and trying AWS CLI to copy a file from an EC2 server to a S3 server.
I receive an error:
A client error (NoSuchBucket) occurred when calling the PutObject operation: The specified bucket does not exist
My command is as follows:
- I went to my S3 dashboard, selected the bucket -> properties and copeied the 'Endpoint' value which is
[bucket name].s3-website-us-west-2.amazonaws.com
- Then executed
aws s3 cp ./file.ext s3://[bucket name].s3-website-us-west-2.amazonaws.com/file.ext
But it failed with the error described earlier - bucket does not exist.
p.s. Running
aws s3api list-buckets --query 'Buckets[].Name'
Shows that the bucket does exist so that isn't the issue to my understanding.
EDIT If I do not use the endpoint but only use the bucket name the error message encourage to use the full name which in all the online examples seems exactly like the endpoint
upload failed: ./file.ext to s3://[bucket name]/file.ext A client error (PermanentRedirect) occurred when calling the PutObject operation: The bucket you are attempting to access must be addressed using the specified endpoint. Please send all future requests to this endpoint: [bucket name].s3.amazonaws.com You can fix this issue by explicitly providing the correct region location using the --region argument, the AWS_DEFAULT_REGION environment variable, or the region variable in the AWS CLI configuration file. You can get the bucket's location by running "aws s3api get-bucket-location --bucket BUCKET".