Configure boto3 for R2
You must generate an Access Key before getting started. All examples will utilize access_key_id and access_key_secret variables which represent the Access Key ID and Secret Access Key values you generated.
You must configure
boto3
to use a preconstructed endpoint_url value. This can be done through any boto3 usage that accepts connection arguments; for example:
You may, however, omit the aws_access_key_id and aws_secret_access_key arguments and allow boto3 to rely on the AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY
environment variables
instead.
An example script may look like the following: