Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(s3-deployment): control object access #15730

Merged
merged 5 commits into from
Aug 2, 2021
Merged

feat(s3-deployment): control object access #15730

merged 5 commits into from
Aug 2, 2021

Conversation

sormy
Copy link
Contributor

@sormy sormy commented Jul 23, 2021

Add support for BucketDeployment accessControl property to aws-s3-deployment package.

This is needed to run, for example, aws s3 sync with --acl bucket-owner-full-control.
Without this feature there is no easy way (without hacking cdk nodes) to sync assets to bucket located in another account.


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

@gitpod-io
Copy link

gitpod-io bot commented Jul 23, 2021

@mergify
Copy link
Contributor

mergify bot commented Jul 23, 2021

Title does not follow the guidelines of Conventional Commits. Please adjust title before merge.

@sormy sormy changed the title Add support for BucketDeployment accessControl property feat: Add support for BucketDeployment accessControl property Jul 23, 2021
@sormy sormy changed the title feat: Add support for BucketDeployment accessControl property feat: add support for BucketDeployment accessControl property Jul 23, 2021
@sormy sormy force-pushed the master branch 2 times, most recently from 5b6f201 to 132a0c7 Compare July 23, 2021 04:55
@sormy sormy changed the title feat: add support for BucketDeployment accessControl property feat(s3-deployment): add support for BucketDeployment accessControl property Jul 23, 2021
@sormy sormy force-pushed the master branch 3 times, most recently from 1c56d62 to 9f8a610 Compare July 25, 2021 03:50
@sormy
Copy link
Contributor Author

sormy commented Jul 26, 2021

Is there anything else I can do for this CR to proceed?

kapilsd
kapilsd previously approved these changes Jul 30, 2021
Copy link
Contributor

@nija-at nija-at left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please see my comments below.

@otaviomacedo - can you also take a look?

@@ -325,6 +325,7 @@ test('system metadata is correctly transformed', () => {
websiteRedirectLocation: 'example',
cacheControl: [s3deploy.CacheControl.setPublic(), s3deploy.CacheControl.maxAge(cdk.Duration.hours(1))],
expires: expiration,
accessControl: s3.BucketAccessControl.BUCKET_OWNER_FULL_CONTROL,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you add a separate test case for each type of BucketAccessControl, so we can ensure that all types are correctly transformed by toKebabCase()?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have added the test.

@@ -165,6 +166,14 @@ export interface BucketDeploymentProps {
*/
readonly serverSideEncryptionCustomerAlgorithm?: string;

/**
* Sets the ACL for the object when the command is performed.
* If you use this parameter you must have the "s3:PutObjectAcl" permission included in the list of actions for your IAM policy.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Which IAM policy should have this permission configured?

I'm not very familiar with this module but usually the CDK ensures that the permissions are correctly configured.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right. This permission is granted by construct. I have removed this sentence.

@@ -177,6 +178,7 @@ new s3deploy.BucketDeployment(this, 'DeployWebsite', {
storageClass: StorageClass.INTELLIGENT_TIERING,
serverSideEncryption: ServerSideEncryption.AES_256,
cacheControl: [CacheControl.setPublic(), CacheControl.maxAge(cdk.Duration.hours(1))],
accessControl: s3.BucketAccessControl.BUCKET_OWNER_FULL_CONTROL,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We usually like to add a couple of sentences on what this feature, when it should be used and any caveats.

Some require a separate section but most just a couple of sentences.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So accessControl is one of system metadata properties like serverSideEncryption and etc. It seems like there is no additional information provided for other system metadata properties here. I have added a note about how system metadata maps to aws s3 sync arguments and where additional information can be obtained.

@@ -165,6 +166,14 @@ export interface BucketDeploymentProps {
*/
readonly serverSideEncryptionCustomerAlgorithm?: string;

/**
* Sets the ACL for the object when the command is performed.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be "objects in this bucket"?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have updated docblock to match other properties related to system metadata.

@nija-at nija-at added the effort/small Small work item – less than a day of effort label Jul 30, 2021
@mergify mergify bot dismissed nija-at’s stale review July 30, 2021 20:56

Pull request has been modified.

@nija-at nija-at changed the title feat(s3-deployment): add support for BucketDeployment accessControl property feat(s3-deployment): control object access Aug 2, 2021
@mergify
Copy link
Contributor

mergify bot commented Aug 2, 2021

Thank you for contributing! Your pull request will be updated from master and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildProject89A8053A-LhjRyN9kxr8o
  • Commit ID: 01921a9
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@mergify mergify bot merged commit f58cf3c into aws:master Aug 2, 2021
@mergify
Copy link
Contributor

mergify bot commented Aug 2, 2021

Thank you for contributing! Your pull request will be updated from master and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

TikiTDO pushed a commit to TikiTDO/aws-cdk that referenced this pull request Aug 3, 2021
Add support for BucketDeployment accessControl property to aws-s3-deployment package.

This is needed to run, for example, `aws s3 sync` with `--acl bucket-owner-full-control`.
Without this feature there is no easy way (without hacking cdk nodes) to sync assets to bucket located in another account.

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
hollanddd pushed a commit to hollanddd/aws-cdk that referenced this pull request Aug 26, 2021
Add support for BucketDeployment accessControl property to aws-s3-deployment package.

This is needed to run, for example, `aws s3 sync` with `--acl bucket-owner-full-control`.
Without this feature there is no easy way (without hacking cdk nodes) to sync assets to bucket located in another account.

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
david-doyle-as24 pushed a commit to david-doyle-as24/aws-cdk that referenced this pull request Sep 7, 2021
Add support for BucketDeployment accessControl property to aws-s3-deployment package.

This is needed to run, for example, `aws s3 sync` with `--acl bucket-owner-full-control`.
Without this feature there is no easy way (without hacking cdk nodes) to sync assets to bucket located in another account.

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/aws-s3-deployment effort/small Small work item – less than a day of effort p1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants