aws-cloudformation / cloudformation-coverage-roadmap

The AWS CloudFormation Public Coverage Roadmap
https://aws.amazon.com/cloudformation/
Creative Commons Attribution Share Alike 4.0 International
1.11k stars 56 forks source link

AWS::S3::Bucket - RequesterPays #123

Open bjorg opened 5 years ago

bjorg commented 5 years ago

1. Title

AWS::S3::Bucket-RequesterPays

2. Scope of request

Enable CloudFormation to set the Requester Pays property on an S3 bucket. Currently, this property can only be set by the AWS console and AWS SDK.

3. Expected behavior

MyBucket:
  Type: AWS::S3::Bucket
  Properties:
    RequestPayment:
      Payer: Requester

5. Helpful Links to speed up research and evaluation

6. Category

  1. Storage (S3)
ghost commented 5 years ago

Such feature would be exceptionally helpful!!!

brett-vendia commented 3 years ago

Hey @rhboyd, any plans for this? 🤗

seekayel commented 3 years ago

Shocked that this isn't supported after 7 years... also sadly not shocked, more like resigned.

~sigh~

cristianrat commented 3 years ago

WOW

matiasgvega commented 3 years ago

Code Snippet to enable the feature using AwsCustomResource:

addRequesterPaysToS3Bucket(prefix: string, stage: string, region: string, bucket: IBucket): AwsCustomResource {
        // AWSSDKCall to apply to onCreate and onUpdate 
        const addRequestPay = {
            action: 'putBucketRequestPayment',
            region: region,
            service: `S3`,
            parameters: {
                Bucket: bucket.bucketName,
                RequestPaymentConfiguration: {
                    Payer: `Requester`
                }
            },
            physicalResourceId: PhysicalResourceId.of(bucket.bucketName)
        }

        const awsCustomResource = new AwsCustomResource(this, `${prefix}-RequesterPaysCustomResource-${stage}`, {
            policy: AwsCustomResourcePolicy.fromSdkCalls({
                resources: [bucket.bucketArn]
            }),
            onCreate: addRequestPay,
            onUpdate: addRequestPay
        });
        awsCustomResource.node.addDependency(bucket)
        return awsCustomResource
    }