Skip to content

Instantly share code, notes, and snippets.

@cbodley
Created May 25, 2018 17:00
Show Gist options
  • Save cbodley/8a261b20cd4747ff83f4c99746cd2c74 to your computer and use it in GitHub Desktop.
Save cbodley/8a261b20cd4747ff83f4c99746cd2c74 to your computer and use it in GitHub Desktop.
#!/usr/bin/python
# create a bucket and enable versioning
import boto3
import sys
# bucket name as first argument
bucketname = sys.argv[1]
endpoint=''
access_key=''
secret_key=''
s3 = boto3.resource('s3',
endpoint_url=endpoint,
aws_access_key_id=access_key,
aws_secret_access_key=secret_key)
bucket = s3.Bucket(bucketname)
bucket.create()
bucket.Versioning().enable()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment