samedi 27 juin 2015

How to create a s3 bucket using Boto3?

I want to enable cloudtrail logs for my account and so need to create an s3 bucket.I wanted to automate this task using Boto3.Currently I am using the following script

sess = Session(aws_access_key_id=tmp_access_key,
                   aws_secret_access_key=tmp_secret_key, aws_session_token=security_token)  
s3_conn_boto3 = sess.client(service_name='s3', region_name=region)  

bucket = s3_conn_boto3.create_bucket(Bucket=access_log_bucket_name,
                                                     CreateBucketConfiguration={'LocationConstraint':'us-east-1'},
                                                     ACL='authenticated-read',..).

I am new to Boto3 so I don't have much knowledge regarding usage of other parameters like GrantWrite,GrantWriteACP etc..

Please help me provide some code snippet regarding create s3 bucket and enabled cloudtrail logs in it.

Thanks




Aucun commentaire:

Enregistrer un commentaire