Skip to content

Instantly share code, notes, and snippets.

@phildini
Created February 8, 2026 21:27
Show Gist options
  • Select an option

  • Save phildini/cdc0e5cc9f0f84c024e253ac8bdd1fa4 to your computer and use it in GitHub Desktop.

Select an option

Save phildini/cdc0e5cc9f0f84c024e253ac8bdd1fa4 to your computer and use it in GitHub Desktop.
How to upload to Fastly Object Storage with boto3
from botocore.config import Config
import boto3
boto_config = Config(
signature_version='s3v4',
request_checksum_calculation='when_required',
response_checksum_validation='when_required',
s3={
'addressing_style': 'path',
},
)
REGION="us-west"
s3_client = boto3.client(
"s3",
aws_access_key_id=AWS_ACCESS_KEY,
aws_secret_access_key=AWS_SECRET_KEY,
endpoint_url=f"https://{REGION}.object.fastlystorage.app",
region_name=REGION,
config=boto_config
)
s3_client.upload_file(
"test.txt",
"civic-band-prod",
"test_upload_file.txt",
ExtraArgs={"ContentType": "text/plain"}
)
print("SUCCESS!", response)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment