aws_s3_policy_doc_create: Create a policy document for an S3 bucket

View source: R/s3.R

aws_s3_policy_doc_createR Documentation

Create a policy document for an S3 bucket

Description

Create a policy document for an S3 bucket

Usage

aws_s3_policy_doc_create(
  bucket,
  action,
  resource,
  effect = "Allow",
  sid = NULL,
  ...
)

Arguments

bucket

(character) bucket name. required

action

(character) an action. required. see Actions below.

resource

(character) the object or objects the statement covers; see link below for more information

effect

(character) valid values: "Allow" (default), "Deny". length==1

sid

(character) a statement id. optional

...

Additional named arguments. See link in Details for options, and examples below

Details

There's this separate function for creating policy docs for S3 because buckets are globally unique, so AWS figures out the region and account ID for you.

Value

a policy document as JSON (of class json)

Examples

bucket <- random_bucket()
aws_s3_policy_doc_create(
  bucket = bucket,
  action = s3_actions_read(),
  resource = c(bucket_arn(bucket), bucket_arn(bucket, objects = "*"))
)

sixtyfour documentation built on April 3, 2025, 8:22 p.m.