# salt.modules.boto_s3_bucket

Connection module for Amazon S3 Buckets

Added in version 2016.3.0.

depends:

  - boto

  - boto3

The dependencies listed above can be installed via package or pip.

configuration:

  This module accepts explicit Lambda credentials but can also utilize IAM roles assigned to the instance through Instance Profiles. Dynamic credentials are then automatically obtained from AWS API and no further configuration is necessary. More Information available at:

      http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/iam-roles-for-amazon-ec2.html

  If IAM roles are not used you need to specify them either in a pillar or in the minion's config file:

      s3.keyid: GKTADJGHEIQSXMKKRBJ08H
      s3.key: askdjghsdfjkghWupUjasdflkdfklgjsdfjajkghs

  A region may also be specified in the configuration:

      s3.region: us-east-1

  If a region is not specified, the default is us-east-1.

  It's also possible to specify key, keyid and region via a profile, either as a passed in dict, or as a string to pull from pillars or minion config:

      myprofile:
          keyid: GKTADJGHEIQSXMKKRBJ08H
          key: askdjghsdfjkghWupUjasdflkdfklgjsdfjajkghs
          region: us-east-1

salt.modules.boto_s3_bucket.create(Bucket, ACL=None, LocationConstraint=None, GrantFullControl=None, GrantRead=None, GrantReadACP=None, GrantWrite=None, GrantWriteACP=None, region=None, key=None, keyid=None, profile=None)

  Given a valid config, create an S3 Bucket.

  Returns {created: true} if the bucket was created and returns {created: False} if the bucket was not created.

  CLI Example:

      salt myminion boto_s3_bucket.create my_bucket \
                       GrantFullControl='emailaddress=example@example.com' \
                       GrantRead='uri="http://acs.amazonaws.com/groups/global/AllUsers"' \
                       GrantReadACP='emailaddress="exampl@example.com",id="2345678909876432"' \
                       LocationConstraint=us-west-1

salt.modules.boto_s3_bucket.delete(Bucket, MFA=None, RequestPayer=None, Force=False, region=None, key=None, keyid=None, profile=None)

  Given a bucket name, delete it, optionally emptying it first.

  Returns {deleted: true} if the bucket was deleted and returns {deleted: false} if the bucket was not deleted.

  CLI Example:

      salt myminion boto_s3_bucket.delete mybucket

salt.modules.boto_s3_bucket.delete_cors(Bucket, region=None, key=None, keyid=None, profile=None)

  Delete the CORS configuration for the given bucket

  Returns {deleted: true} if CORS was deleted and returns {deleted: False} if CORS was not deleted.

  CLI Example:

      salt myminion boto_s3_bucket.delete_cors my_bucket

salt.modules.boto_s3_bucket.delete_lifecycle_configuration(Bucket, region=None, key=None, keyid=None, profile=None)

  Delete the lifecycle configuration for the given bucket

  Returns {deleted: true} if Lifecycle was deleted and returns {deleted: False} if Lifecycle was not deleted.

  CLI Example:

      salt myminion boto_s3_bucket.delete_lifecycle_configuration my_bucket

salt.modules.boto_s3_bucket.delete_objects(Bucket, Delete, MFA=None, RequestPayer=None, region=None, key=None, keyid=None, profile=None)

  Delete objects in a given S3 bucket.

  Returns {deleted: true} if all objects were deleted and {deleted: false, failed: [key, ...]} otherwise

  CLI Example:

      salt myminion boto_s3_bucket.delete_objects mybucket '{Objects: [Key: myobject]}'

salt.modules.boto_s3_bucket.delete_policy(Bucket, region=None, key=None, keyid=None, profile=None)

  Delete the policy from the given bucket

  Returns {deleted: true} if policy was deleted and returns {deleted: False} if policy was not deleted.

  CLI Example:

      salt myminion boto_s3_bucket.delete_policy my_bucket

salt.modules.boto_s3_bucket.delete_replication(Bucket, region=None, key=None, keyid=None, profile=None)

  Delete the replication config from the given bucket

  Returns {deleted: true} if replication configuration was deleted and returns {deleted: False} if replication configuration was not deleted.

  CLI Example:

      salt myminion boto_s3_bucket.delete_replication my_bucket

salt.modules.boto_s3_bucket.delete_tagging(Bucket, region=None, key=None, keyid=None, profile=None)

  Delete the tags from the given bucket

  Returns {deleted: true} if tags were deleted and returns {deleted: False} if tags were not deleted.

  CLI Example:

      salt myminion boto_s3_bucket.delete_tagging my_bucket

salt.modules.boto_s3_bucket.delete_website(Bucket, region=None, key=None, keyid=None, profile=None)

  Remove the website configuration from the given bucket

  Returns {deleted: true} if website configuration was deleted and returns {deleted: False} if website configuration was not deleted.

  CLI Example:

      salt myminion boto_s3_bucket.delete_website my_bucket

salt.modules.boto_s3_bucket.describe(Bucket, region=None, key=None, keyid=None, profile=None)

  Given a bucket name describe its properties.

  Returns a dictionary of interesting properties.

  CLI Example:

      salt myminion boto_s3_bucket.describe mybucket

salt.modules.boto_s3_bucket.empty(Bucket, MFA=None, RequestPayer=None, region=None, key=None, keyid=None, profile=None)

  Delete all objects in a given S3 bucket.

  Returns {deleted: true} if all objects were deleted and {deleted: false, failed: [key, ...]} otherwise

  CLI Example:

      salt myminion boto_s3_bucket.empty mybucket

salt.modules.boto_s3_bucket.exists(Bucket, region=None, key=None, keyid=None, profile=None)

  Given a bucket name, check to see if the given bucket exists.

  Returns True if the given bucket exists and returns False if the given bucket does not exist.

  CLI Example:

      salt myminion boto_s3_bucket.exists mybucket

salt.modules.boto_s3_bucket.list(region=None, key=None, keyid=None, profile=None)

  List all buckets owned by the authenticated sender of the request.

  Returns list of buckets

  CLI Example:

      Owner: {...}
      Buckets:
        - {...}
        - {...}

salt.modules.boto_s3_bucket.list_object_versions(Bucket, Delimiter=None, EncodingType=None, Prefix=None, region=None, key=None, keyid=None, profile=None)

  List objects in a given S3 bucket.

  Returns a list of objects.

  CLI Example:

      salt myminion boto_s3_bucket.list_object_versions mybucket

salt.modules.boto_s3_bucket.list_objects(Bucket, Delimiter=None, EncodingType=None, Prefix=None, FetchOwner=False, StartAfter=None, region=None, key=None, keyid=None, profile=None)

  List objects in a given S3 bucket.

  Returns a list of objects.

  CLI Example:

      salt myminion boto_s3_bucket.list_objects mybucket

salt.modules.boto_s3_bucket.put_acl(Bucket, ACL=None, AccessControlPolicy=None, GrantFullControl=None, GrantRead=None, GrantReadACP=None, GrantWrite=None, GrantWriteACP=None, region=None, key=None, keyid=None, profile=None)

  Given a valid config, update the ACL for a bucket.

  Returns {updated: true} if the ACL was updated and returns {updated: False} if the ACL was not updated.

  CLI Example:

      salt myminion boto_s3_bucket.put_acl my_bucket 'public' \
                       GrantFullControl='emailaddress=example@example.com' \
                       GrantRead='uri="http://acs.amazonaws.com/groups/global/AllUsers"' \
                       GrantReadACP='emailaddress="exampl@example.com",id="2345678909876432"'

salt.modules.boto_s3_bucket.put_cors(Bucket, CORSRules, region=None, key=None, keyid=None, profile=None)

  Given a valid config, update the CORS rules for a bucket.

  Returns {updated: true} if CORS was updated and returns {updated: False} if CORS was not updated.

  CLI Example:

      salt myminion boto_s3_bucket.put_cors my_bucket '[{\
            "AllowedHeaders":[],\
            "AllowedMethods":["GET"],\
            "AllowedOrigins":["*"],\
            "ExposeHeaders":[],\
            "MaxAgeSeconds":123,\
      }]'

salt.modules.boto_s3_bucket.put_lifecycle_configuration(Bucket, Rules, region=None, key=None, keyid=None, profile=None)

  Given a valid config, update the Lifecycle rules for a bucket.

  Returns {updated: true} if Lifecycle was updated and returns {updated: False} if Lifecycle was not updated.

  CLI Example:

      salt myminion boto_s3_bucket.put_lifecycle_configuration my_bucket '[{\
            "Expiration": {...},\
            "ID": "idstring",\
            "Prefix": "prefixstring",\
            "Status": "enabled",\
            "Transitions": [{...},],\
            "NoncurrentVersionTransitions": [{...},],\
            "NoncurrentVersionExpiration": {...},\
      }]'

salt.modules.boto_s3_bucket.put_logging(Bucket, TargetBucket=None, TargetPrefix=None, TargetGrants=None, region=None, key=None, keyid=None, profile=None)

  Given a valid config, update the logging parameters for a bucket.

  Returns {updated: true} if parameters were updated and returns {updated: False} if parameters were not updated.

  CLI Example:

      salt myminion boto_s3_bucket.put_logging my_bucket log_bucket '[{...}]' prefix

salt.modules.boto_s3_bucket.put_notification_configuration(Bucket, TopicConfigurations=None, QueueConfigurations=None, LambdaFunctionConfigurations=None, region=None, key=None, keyid=None, profile=None)

  Given a valid config, update the notification parameters for a bucket.

  Returns {updated: true} if parameters were updated and returns {updated: False} if parameters were not updated.

  CLI Example:

      salt myminion boto_s3_bucket.put_notification_configuration my_bucket
              [{...}] \
              [{...}] \
              [{...}]

salt.modules.boto_s3_bucket.put_policy(Bucket, Policy, region=None, key=None, keyid=None, profile=None)

  Given a valid config, update the policy for a bucket.

  Returns {updated: true} if policy was updated and returns {updated: False} if policy was not updated.

  CLI Example:

      salt myminion boto_s3_bucket.put_policy my_bucket {...}

salt.modules.boto_s3_bucket.put_replication(Bucket, Role, Rules, region=None, key=None, keyid=None, profile=None)

  Given a valid config, update the replication configuration for a bucket.

  Returns {updated: true} if replication configuration was updated and returns {updated: False} if replication configuration was not updated.

  CLI Example:

      salt myminion boto_s3_bucket.put_replication my_bucket my_role [...]

salt.modules.boto_s3_bucket.put_request_payment(Bucket, Payer, region=None, key=None, keyid=None, profile=None)

  Given a valid config, update the request payment configuration for a bucket.

  Returns {updated: true} if request payment configuration was updated and returns {updated: False} if request payment configuration was not updated.

  CLI Example:

      salt myminion boto_s3_bucket.put_request_payment my_bucket Requester

salt.modules.boto_s3_bucket.put_tagging(Bucket, region=None, key=None, keyid=None, profile=None, **kwargs)

  Given a valid config, update the tags for a bucket.

  Returns {updated: true} if tags were updated and returns {updated: False} if tags were not updated.

  CLI Example:

      salt myminion boto_s3_bucket.put_tagging my_bucket my_role [...]

salt.modules.boto_s3_bucket.put_versioning(Bucket, Status, MFADelete=None, MFA=None, region=None, key=None, keyid=None, profile=None)

  Given a valid config, update the versioning configuration for a bucket.

  Returns {updated: true} if versioning configuration was updated and returns {updated: False} if versioning configuration was not updated.

  CLI Example:

      salt myminion boto_s3_bucket.put_versioning my_bucket Enabled

salt.modules.boto_s3_bucket.put_website(Bucket, ErrorDocument=None, IndexDocument=None, RedirectAllRequestsTo=None, RoutingRules=None, region=None, key=None, keyid=None, profile=None)

  Given a valid config, update the website configuration for a bucket.

  Returns {updated: true} if website configuration was updated and returns {updated: False} if website configuration was not updated.

  CLI Example:

      salt myminion boto_s3_bucket.put_website my_bucket IndexDocument='{"Suffix":"index.html"}'