s3_bucket – Manage S3 bucket¶
Creation and deletion of an AWS S3 bucket.
Examples¶
- name: Create an S3 bucket
s3_bucket:
state: present
name: xbucket-2020-02-11-1581427332
public_access: true
Parameters¶
- access_logging (optional)
Access logging provides records for the requests that are made to a bucket.
type: bool- auth (optional)
Parameters for authenticating with the AWS service. Each of them may be defined via environment variables.
type: dict- access_key (optional)
The AWS access key ID. If not set, the value of the AWS_ACCESS_KEY environment variable will be checked.
Mutually exclusive with profile.
type: str- profile (optional)
The name of the AWS profile configured with
aws configure
.Can be used instead of explicitly specifying your access credentials and region.
Use
default
to use the default profile.Mutually exclusive with access_key and secret_key.
type: str- region (optional)
The name of the AWS region.
If not set, the value of the AWS_REGION environment variable will be checked.
If you set a profile that specifies a default region, that region is used and you can omit this parameter. Use this parameter to override the profile’s default region.
type: str- secret_key (optional)
The AWS secret access key. If not set, the value of the AWS_SECRET_KEY environment variable will be checked.
Mutually exclusive with profile.
type: str- url (optional)
The URL to the AWS service related to the resource. By default, this is automatically determined through the region parameter.
If not set explicitly, the value of the AWS_<SERVICE>_URL environment variable will be used.
The services currently supported are EC2 and S3.
type: str
- clear_tags (optional)
Whether to clear any existing tags on the resource that are not explicitly stated in tags.
By default, existing tags are kept on the resource.
When this parameter is set to
true
, any pre-existing tags on the resource are removed.type: bool- name (required)
Name of S3 bucket. Not every string is an acceptable bucket name.
The name must be unique across all existing bucket names in Amazon S3.
For naming restrictions see https://docs.aws.amazon.com/AmazonS3/latest/dev/BucketRestrictions.html
type: str- public_access (optional)
Ensure that public access to your S3 buckets and objects is blocked.
type: bool- state (optional)
Target state of the Bucket.
If absent, it will delete bucket even if it is not empty.
type: strdefault: presentchoices: present, absent- tags (optional)
Metadata for the AWS resource as key/value pairs.
Keys and values are case-sensitive.
type: dict- versioning (optional)
Enables you to keep multiple versions of an object in the same bucket.
type: strdefault: suspendedchoices: enabled, suspended
Return Values¶
- object (success), complex,
An object representing an S3 Bucket.
- name (always), str, steamybucket
Name of S3 bucket.
- versioning (always), bool, False
If there are multiple versions of an object in the same bucket.
- access_logging (always), bool, False
If records for the requests are enabled.
- public_access (always), bool, False
If public access to your S3 buckets and objects is blocked.
- tags (always), dict, {‘Name’: ‘my-s3-bucket’}
Tags associated with the S3 Bucket.