Documentation

Manage Assets Using s3cmd

To connect to the Servd Assets Platform using s3cmd, first ensure you have an up-to-date version installed. You can also install on macOS using brew:

brew install s3cmd

Once installed you'll need to configure s3cmd to tell it how to connect to the Servd platform by running the following command and referring to the values below:

s3cmd --configure

Asset Platform V3 #

You can obtain the following values from the Servd dashboard on the Project Settings > Assets page:

Access Key ID

Access Key Secret

S3 Endpoint

Region

Bucket Name

Once generated your key and secret will be valid indefinitely.

Access Key: [Access Key ID]

Secret Key: [Access Key Secret]

Default Region: [Region]

S3 Endpoint: [S3 Endpoint]

DNS-style bucket+hostname:port template: %(bucket)s.[S3 Endpoint]

Encryption password: `[any random string]`

Path to GPG program: `[accept the default suggestion]`

Use HTTPS protocol: `yes`

HTTP Proxy server name: `[leave blank unless you know you need this]`

Test access with supplied credentials?: `yes`

Save settings?: `yes`

You can now use s3cmd to explore and upload files to the Servd asset platform. Below are a few commands that you might find useful.

# List the files in your asset platform directory
s3cmd ls s3://[bucket-name]/

# All upload and download commands can be tested by adding the --dry-run flag.
# This will display the source and destination paths that would be affected, but won't alter any files
# Once you have confirmed the paths look ok, remove the --dry-run flag and re-run the command

# Upload a file
s3cmd --dry-run put ./my-cat.jpg s3://[bucket-name]/production/

# Delete a file
s3cmd --dry-run del s3://[bucket-name]/production/my-cat.jpg

# Upload a folder
s3cmd --dry-run put --recursive ./cat-photos s3://[bucket-name]/production/

# Sync a folder - this will also delete any remote files which don't exist locally
s3cmd --dry-run sync ./cat-photos s3://[bucket-name]/production/cat-photos

Asset Platform V2 (Legacy) #

You can obtain the following values from the Servd dashboard on the Project Settings > Assets page:

Access Key ID

Access Key Secret

S3 Endpoint

Region

Bucket Name

Once generated your key and secret will be valid for 24 hours only.

Access Key: `[Access Key ID]`

Secret Key: `[Access Key Secret]`

Default Region: `eu-central-003`

S3 Endpoint: `s3.eu-central-003.backblazeb2.com`

DNS-style bucket+hostname:port template: `%(bucket)s.s3.eu-central-003.backblazeb2.com`

Encryption password: `[any random string]`

Path to GPG program: `[accept the default suggestion]`

Use HTTPS protocol: `yes`

HTTP Proxy server name: `[leave blank unless you know you need this]`

Test access with supplied credentials?: `yes`

Save settings?: `yes`
# List the files in your asset platform directory
s3cmd ls s3://cdn-assets-servd-host/[your-project-slug]/

# All upload and download commands can be tested by adding the --dry-run flag.
# This will display the source and destination paths that would be affected, but won't alter any files
# Once you have confirmed the paths look ok, remove the --dry-run flag and re-run the command

# Upload a file
s3cmd --dry-run put ./my-cat.jpg s3://cdn-assets-servd-host/[your-project-slug]/production/

# Delete a file
s3cmd --dry-run del s3://cdn-assets-servd-host/[your-project-slug]/production/my-cat.jpg

# Upload a folder
s3cmd --dry-run put --recursive ./cat-photos s3://cdn-assets-servd-host/[your-project-slug]/production/

# Sync a folder - this will also delete any remote files which don't exist locally
s3cmd --dry-run sync ./cat-photos s3://cdn-assets-servd-host/[your-project-slug]/production/cat-photos