Learn R Programming

aws.s3 (version 0.3.21)

put_bucket: Create bucket

Description

Creates a new S3 bucket.

Usage

put_bucket(
  bucket,
  region = Sys.getenv("AWS_DEFAULT_REGION"),
  acl = c("private", "public-read", "public-read-write", "aws-exec-read",
    "authenticated-read", "bucket-owner-read", "bucket-owner-full-control"),
  location_constraint = region,
  headers = list(),
  ...
)

Arguments

bucket

Character string with the name of the bucket, or an object of class “s3_bucket”.

region

A character string containing the AWS region. If missing, defaults to value of environment variable AWS_DEFAULT_REGION.

acl

A character string indicating a “canned” access control list. By default all bucket contents and objects therein are given the ACL “private”. This can later be viewed using get_acl and modified using put_acl.

location_constraint

A character string specifying a location constraint. If NULL (for example, for S3-compatible storage), no LocationConstraint body is passed.

headers

List of request headers for the REST call.

Additional arguments passed to s3HTTP.

Value

TRUE if successful.

Details

Bucket policies regulate who has what access to a bucket and its contents. The header argument can beused to specify “canned” policies and put_bucket_policy can be used to specify a more complex policy. The AWS Policy Generator can be useful for creating the appropriate JSON policy structure.

References

API Documentation AWS Policy Generator

See Also

bucketlist, get_bucket, delete_bucket, put_object, put_encryption, put_versioning

Examples

Run this code
# NOT RUN {
  put_bucket("examplebucket")
  
  # set a "canned" ACL to, e.g., make bucket publicly readable
  put_bucket("examplebucket", headers = list(`x-amz-acl` = "public-read")

# }

Run the code above in your browser using DataLab