How do I create a signed public 'share' URL similar to the 'Quick Share' option in Spaces?

How do I create a signed public ‘share’ URL similar to the ‘Quick Share’ option in Spaces?

I am writing an application in Node.JS and would like to return a temporary access URL to the user so they can access a file stored in spaces for a set amount of time. The Space itself is set to Private and the files are all Private as well, so just giving a direct URL to them isn’t possible.

The DigitalOcean UI already has this “Quick Share” feature, but there doesn’t seem to be any documentation about what its doing to create that URL and I cant figure out how to sign the request correctly to generate one myself.

The URL parameters in question are, AWSAccessKeyId, Expires and Signature. The AWSAccessKeyId and Expires seem simple enough, but how do I go about calculating the signature?

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

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.

Andrew SB
DigitalOcean Employee
DigitalOcean Employee badge
October 16, 2017
Accepted Answer

The AWS signature formats can be a bit complicated. Though the reason for making Spaces compatible with the S3 API is that there are already quite a few tools that can work with it. If you’re working with Node, I’d encourage you to use one of the existing libraries.

The aws-sdk-js can help generate these “pre-signed” URLs. Here’s a quick basic example of it’s usage:

const AWS = require('aws-sdk')

const spacesEndpoint = new AWS.Endpoint('');
const s3 = new AWS.S3({
    endpoint: spacesEndpoint,
    accessKeyId: 'ACCESSKEY',
    secretAccessKey: 'SECRETKEY'

const bucket = 'my-bucket-name'
const key = 'my-file-name.ext'
const expireSeconds = 60 * 5

const url = s3.getSignedUrl('getObject', {
    Bucket: bucket,
    Key: key,
    Expires: expireSeconds


You need to add ASL

	req, _ := db.IS3Event.PutObjectRequest(&s3.PutObjectInput{
		Bucket: constants.ENV_S3_BUCKET_NAME_EVENT,
		Key:    &uniqueKey,
		ACL:    aws.String("public-read"),

How to achieve it using PHP?

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Featured on Community

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more
DigitalOcean Cloud Control Panel