Question

How do I create a Space using the Digital Ocean API?

Posted September 2, 2021 73 views
Object Storage

In the Digital Ocean API reference I see information on creating a CDN endpoint, but not for actually creating a Space (Object Storage Solution). Is this the same thing? If not, can someone point me to the correct documentation? Thanks!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

×
Submit an Answer
1 answer

I think you are better of using the Amazon S3 SDK https://docs.digitalocean.com/products/spaces/resources/s3-sdk-examples/ .

They do show at https://docs.digitalocean.com/reference/api/spaces-api/ how a bucket using a put request winds up being:

PUT / HTTP/1.1

Host: static-images.nyc3.digitaloceanspaces.com
x-amz-acl: public-read
x-amz-content-sha256: c6f1fc479f5f690c443b73a258aacc06ddad09eca0b001e9640ff2cd56fe5710
x-amz-date: 20170710T173143Z
Authorization: AWS4-HMAC-SHA256 Credential=II5JDQBAN3JYM4DNEB6C/20170710/nyc3/s3/aws4_request,SignedHeaders=host;x-amz-acl;x-amz-content-sha256;x-amz-date,Signature=6cab03bef74a80a0441ab7fd33c829a2cdb46bba07e82da518cdb78ac238fda5

<CreateBucketConfiguration>
  <LocationConstraint>nyc3</LocationConstraint>
</CreateBucketConfiguration>

but they do not show/have doctl commands for spaces https://docs.digitalocean.com/reference/doctl/reference/

Seems as Spaces is compatible with S3 you should use their SDK for Spaces.