Skip to content

Instantly share code, notes, and snippets.

@jonasfj
Created June 10, 2016 21:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jonasfj/c129216da7ea73c1fa96ff80210ac507 to your computer and use it in GitHub Desktop.
Save jonasfj/c129216da7ea73c1fa96ff80210ac507 to your computer and use it in GitHub Desktop.
import taskcluster, boto.s3
auth = taskcluster.sync.Auth()
result = auth.awsS3Credentials('read-write', 'tc-gp-public-31d', 'garbage/')
s3 = boto.s3.connect_to_region(
'us-west-2',
aws_access_key_id=result['credentials']['accessKeyId'],
aws_secret_access_key=result['credentials']['secretAccessKey'],
security_token=result['credentials']['sessionToken'],
)
bucket = s3.get_bucket('tc-gp-public-31d', validate=False)
k = bucket.new_key('garbage/test.txt')
k.set_contents_from_string("Hello World")
print "https://tc-gp-public-31d.s3-us-west-2.amazonaws.com/garbage/test.txt"
@jonasfj
Copy link
Author

jonasfj commented Jun 10, 2016

pip install taskcluster boto first...

But really we should probably be switching to boto3.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment