26

How to use AWS CLI with Digital Ocean Spaces? Is it possible?

I tried to add my key id and secret to .aws/credentials but I got:

An error occurred (InvalidAccessKeyId) when calling the ListBuckets operation: The AWS Access Key Id you provided does not exist in our record

Roman Pokrovskij
  • 9,449
  • 21
  • 87
  • 142
paul
  • 569
  • 9
  • 13

1 Answers1

44

In order to use the AWS CLI with object storage service that provide an S3-compatible API like DigitalOcean Spaces, you must also configure a custom endpoint.

This can be done on the command line using the --endpoint flag:

aws s3 ls --endpoint=https://nyc3.digitaloceanspaces.com
andrewsomething
  • 2,146
  • 2
  • 18
  • 22
  • 12
    Worth pointing out that there's no way currently to have a default endpoint. You gotta specify it every time. I usually alias it for convenience: `alias awsdo='aws --endpoint=https://nyc3.digitaloceanspaces.com'` – Freedom_Ben Jun 12 '19 at 23:47
  • 3
    Also, commands like `aws s3 sync` do _not_ work with spaces endpoints, so the working alternative is using rclone. – Niloct Dec 05 '19 at 19:30
  • 8
    @Niloct's comment may have been true at the time of posting, but it is no longer true as I am able to use `aws s3 sync` with spaces endpoints. – Onel Harrison Dec 23 '19 at 18:32
  • 1
    @OnelHarrison thanks for your update. Anyway rclone has a very nice feature that only copies files changed in last n minutes without traversing the spaces file structure, and that is REALLY fast. I'm using it with success. – Niloct Dec 26 '19 at 22:59