Spaces uses an S3-compatible API and, as such, the existing S3 configuration in CDN is almost all that’s needed to connect your CDN installation to your Digital Ocean Space - only one extra endpoint
configuration property is required to tell CDN where to find your assets.
"images": {
"s3": {
"enabled": true,
"accessKey": "your-access-key",
"secretKey": "your-secret",
"bucketName": "your-space-name",
"region": "your-region",
"endpoint": "your-digital-ocean-endpoint" // new endpoint configuration
}
}
🔗Configuring CDN for Digital Ocean Spaces
🔗Creating a Space
If you don’t have a Space already, click the “Spaces” menu item in your Digital Ocean account to load the Spaces overview, then “Create a Space”. Give your Space a name, choose a region and click “Create a Space” to finish.
When creating a Space you are given a URL for the Space that contains the Space name and the region you selected:
https://<name>.<region>.digitaloceanspaces.com
The endpoint for configuring CDN is the <region>.digitaloceanspaces.com
portion of this URL, for example sgp1.digitaloceanspaces.com
. Add this to the endpoint
property in CDN’s S3 configuration block:
"images": {
"s3": {
"enabled": true,
"accessKey": "your-access-key",
"secretKey": "your-secret",
"bucketName": "cdn-demo",
"region": "sgp1",
"endpoint": "sgp1.digitaloceanspaces.com"
}
}
🔗Access Keys
Spaces access keys can be found under the “API” menu when logged into your Digital Ocean account. If you don’t have one already, generate a new key and use the key and secret in the S3 configuration block in your CDN configuration file:
"images": {
"s3": {
"enabled": true,
"accessKey": "KJGWLK7S4DON3R5TNAKT",
"secretKey": "your-secret",
"bucketName": "cdn-demo",
"region": "sgp1",
"endpoint": "sgp1.digitaloceanspaces.com"
}
}
🔗Further reading
The above information (and a lot more besides) can be found in the latest CDN documentation at https://docs.dadi.cloud/cdn/3.2#amazon-s3-and-digital-ocean-spaces.