s3-secure-bucket 0.5.6 → 0.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/.editorconfig +12 -0
  2. package/.jsii +44 -16
  3. package/API.md +29 -0
  4. package/README.md +38 -17
  5. package/lib/core/access-log-delivery-scope.js +54 -0
  6. package/lib/{bucket-types → core}/bucket-type.d.ts +3 -0
  7. package/lib/core/bucket-type.js +54 -0
  8. package/lib/{bucket-types → core}/encryption-default.js +1 -1
  9. package/lib/{bucket-policies/access-log-bucket-policy.js → core/policies/access-log.js} +9 -7
  10. package/lib/{bucket-policies/index.d.ts → core/policies/apply-bucket-policies.d.ts} +5 -3
  11. package/lib/core/policies/apply-bucket-policies.js +38 -0
  12. package/lib/core/policies/cloud-watch-log-archive.js +91 -0
  13. package/lib/core/policies/cloudfront-origin.d.ts +16 -0
  14. package/lib/core/policies/cloudfront-origin.js +73 -0
  15. package/lib/core/policies/deployment-pipeline-artifact.js +69 -0
  16. package/lib/{bucket-policies → core/policies}/resolve-access-log-delivery.d.ts +1 -1
  17. package/lib/core/policies/resolve-access-log-delivery.js +65 -0
  18. package/lib/{bucket-policies → core/policies}/types.d.ts +1 -1
  19. package/lib/core/policies/types.js +3 -0
  20. package/lib/core/props.js +38 -0
  21. package/lib/index.d.ts +3 -2
  22. package/lib/index.js +3 -3
  23. package/lib/s3-secure-bucket.d.ts +28 -1
  24. package/lib/s3-secure-bucket.js +45 -20
  25. package/package.json +4 -3
  26. package/lib/bucket-policies/cloud-watch-log-archive-policy.js +0 -89
  27. package/lib/bucket-policies/deployment-pipeline-artifact-policy.js +0 -69
  28. package/lib/bucket-policies/index.js +0 -36
  29. package/lib/bucket-policies/resolve-access-log-delivery.js +0 -65
  30. package/lib/bucket-policies/types.js +0 -3
  31. package/lib/bucket-types/access-log-delivery-scope.js +0 -54
  32. package/lib/bucket-types/bucket-type.js +0 -51
  33. package/lib/bucket-types/index.d.ts +0 -9
  34. package/lib/bucket-types/index.js +0 -13
  35. package/lib/bucket-types/props.js +0 -38
  36. /package/lib/{bucket-types → core}/access-log-delivery-scope.d.ts +0 -0
  37. /package/lib/{bucket-types → core}/encryption-default.d.ts +0 -0
  38. /package/lib/{bucket-policies/access-log-bucket-policy.d.ts → core/policies/access-log.d.ts} +0 -0
  39. /package/lib/{bucket-policies/cloud-watch-log-archive-policy.d.ts → core/policies/cloud-watch-log-archive.d.ts} +0 -0
  40. /package/lib/{bucket-policies/deployment-pipeline-artifact-policy.d.ts → core/policies/deployment-pipeline-artifact.d.ts} +0 -0
  41. /package/lib/{bucket-types → core}/props.d.ts +0 -0
package/.editorconfig ADDED
@@ -0,0 +1,12 @@
1
+ # ~~ Generated by projen. To modify, edit .projenrc.ts and run "npx projen".
2
+
3
+ root=true
4
+
5
+ [*]
6
+ end_of_line=lf
7
+ charset=utf-8
8
+
9
+ [*\.{js,ts}]
10
+ indent_style=space
11
+ indent_size=2
12
+ max_line_length=120
package/.jsii CHANGED
@@ -8440,7 +8440,7 @@
8440
8440
  "stability": "stable"
8441
8441
  },
8442
8442
  "homepage": "https://github.com/gammarers-aws-cdk-resources/s3-secure-bucket.git",
8443
- "jsiiVersion": "6.0.16 (build 15002ec)",
8443
+ "jsiiVersion": "6.0.17 (build e6a458c)",
8444
8444
  "keywords": [
8445
8445
  "cdk"
8446
8446
  ],
@@ -8456,7 +8456,7 @@
8456
8456
  },
8457
8457
  "name": "s3-secure-bucket",
8458
8458
  "readme": {
8459
- "markdown": "# S3 Secure Bucket (AWS CDK v2)\n\n[![GitHub](https://img.shields.io/github/license/gammarers-aws-cdk-resources/s3-secure-bucket?style=flat-square)](https://github.com/gammarers-aws-cdk-resources/s3-secure-bucket/blob/main/LICENSE)\n[![npm version](https://img.shields.io/npm/v/s3-secure-bucket?style=flat-square)](https://www.npmjs.com/package/s3-secure-bucket)\n[![GitHub Workflow Status (branch)](https://img.shields.io/github/actions/workflow/status/gammarers-aws-cdk-resources/s3-secure-bucket/build.yml?branch=main&label=build&style=flat-square)](https://github.com/gammarers-aws-cdk-resources/s3-secure-bucket/actions/workflows/build.yml)\n[![GitHub Workflow Status (branch)](https://img.shields.io/github/actions/workflow/status/gammarers-aws-cdk-resources/s3-secure-bucket/release.yml?branch=main&label=release&style=flat-square)](https://github.com/gammarers-aws-cdk-resources/s3-secure-bucket/actions/workflows/release.yml)\n[![GitHub release (latest SemVer)](https://img.shields.io/github/v/release/gammarers-aws-cdk-resources/s3-secure-bucket?sort=semver&style=flat-square)](https://github.com/gammarers-aws-cdk-resources/s3-secure-bucket/releases)\n\nAWS CDK v2 construct library: an [`s3.Bucket`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_s3.Bucket.html) with security-focused defaults (private ACLs, block public access, TLS-only access, encryption, versioning, `BucketOwnerEnforced`, `RemovalPolicy.RETAIN`). Use `bucketType` so encryption and bucket policies match pipeline artifacts, CloudFront origins, centralized access logs, and CloudWatch Logs export archives.\n\n## Features\n\n- Private access, block public access, and deny insecure transport (`enforceSSL`)\n- **Default bucket**: KMS-managed encryption (`aws:kms`) unless overridden\n- **Log / origin / archive types**: S3-managed encryption (`AES256`) for `ACCESS_LOG_BUCKET`, `CLOUDFRONT_ORIGIN_BUCKET`, and `CLOUD_WATCH_LOG_ARCHIVE_BUCKET`\n- Versioning on by default; object ownership `BucketOwnerEnforced` by default\n- `RemovalPolicy.RETAIN` on the bucket\n- Optional EventBridge notifications via `eventBridgeEnabled` (applied through an L1 property override when `true`)\n- **`bucketType` presets**\n - **`DEFAULT_BUCKET`**: general-purpose secure bucket (KMS-managed encryption by default)\n - **`DEPLOYMENT_PIPELINE_ARTIFACT_BUCKET`**: optional `s3:*` grant for the CDK deploy role when using a **non-default** bootstrap qualifier\n - **`CLOUDFRONT_ORIGIN_BUCKET`**: S3-managed encryption for typical CloudFront origin use\n - **`ACCESS_LOG_BUCKET`**: `s3:PutObject` for ALB/NLB (`logdelivery.elasticloadbalancing.amazonaws.com` + regional **ELBv2 account** from `aws-cdk-lib/region-info` when known), CloudFront standard logging (`delivery.logs.amazonaws.com`), and S3 server access logging (`logging.s3.amazonaws.com`). Writers default to `AWSLogs/<stack account>/*`; override with `accessLogDelivery` (`allowedSourceAccountIds` or `organizationId`)\n - **`CLOUD_WATCH_LOG_ARCHIVE_BUCKET`**: `s3:GetBucketAcl` and `s3:PutObject` (`bucket-owner-full-control`) for CloudWatch Logs export tasks (`logs.<region>.amazonaws.com`, same-account log groups in the stack Region)\n- **`accessLogBucketPolicyDependable`** (access-log buckets only): use with `loadBalancer.node.addDependency(...)` so ALB/NLB access-log enablement runs after the bucket policy exists (avoids validation `PutObject` failures)\n\n## Installation\n\n**npm**\n\n```shell\nnpm install s3-secure-bucket\n```\n\n**yarn**\n\n```shell\nyarn add s3-secure-bucket\n```\n\n## Usage\n\n### Default secure bucket\n\n```typescript\nimport { Stack } from 'aws-cdk-lib';\nimport { S3SecureBucket } from 's3-secure-bucket';\n\ndeclare const stack: Stack;\n\nconst bucket = new S3SecureBucket(stack, 'S3SecureBucket', {\n bucketName: 'example-secure-bucket',\n});\n```\n\n### CDK deployment pipeline artifact bucket\n\nWhen the stack uses a **non-default** CDK bootstrap qualifier, the construct grants `s3:*` on the bucket to the regional `cdk-<qualifier>-deploy-role`.\n\n```typescript\nimport { Stack } from 'aws-cdk-lib';\nimport { S3SecureBucket, S3SecureBucketType } from 's3-secure-bucket';\n\ndeclare const stack: Stack;\n\nconst artifactBucket = new S3SecureBucket(stack, 'ArtifactBucket', {\n bucketType: S3SecureBucketType.DEPLOYMENT_PIPELINE_ARTIFACT_BUCKET,\n});\n```\n\n### CloudFront origin bucket\n\n```typescript\nimport { Stack } from 'aws-cdk-lib';\nimport { S3SecureBucket, S3SecureBucketType } from 's3-secure-bucket';\n\ndeclare const stack: Stack;\n\nconst originBucket = new S3SecureBucket(stack, 'OriginBucket', {\n bucketType: S3SecureBucketType.CLOUDFRONT_ORIGIN_BUCKET,\n});\n```\n\nWire the bucket to CloudFront (for example `origins.S3Origin`) using your usual approach. This library only configures the **bucket** defaults and encryption.\n\n### Centralized access log bucket (ALB / NLB / CloudFront / S3)\n\nFor `ACCESS_LOG_BUCKET`, the stack **`env.region` must be a concrete region** at synthesis time (not a token) so the regional ELBv2 log-delivery account ID can be resolved when the region is known.\n\n```typescript\nimport { Stack } from 'aws-cdk-lib';\nimport { S3SecureBucket, S3SecureBucketType } from 's3-secure-bucket';\n\ndeclare const stack: Stack;\n\nconst accessLogBucket = new S3SecureBucket(stack, 'AccessLogBucket', {\n bucketType: S3SecureBucketType.ACCESS_LOG_BUCKET,\n});\n\n// After creating your load balancer (e.g. elbv2.ApplicationLoadBalancer), depend on the bucket policy\n// so ELB's validation PutObject runs after the policy exists:\n// loadBalancer.node.addDependency(accessLogBucket.accessLogBucketPolicyDependable!);\n```\n\nTo accept logs from other accounts, set **exactly one** of the following on `accessLogDelivery` (the stack account is **not** added automatically):\n\n```typescript\nconst multiAccountLogBucket = new S3SecureBucket(stack, 'MultiAccountAccessLogBucket', {\n bucketType: S3SecureBucketType.ACCESS_LOG_BUCKET,\n accessLogDelivery: {\n allowedSourceAccountIds: ['111111111111', '222222222222'],\n },\n});\n\nconst organizationLogBucket = new S3SecureBucket(stack, 'OrganizationAccessLogBucket', {\n bucketType: S3SecureBucketType.ACCESS_LOG_BUCKET,\n accessLogDelivery: {\n organizationId: 'o-xxxxxxxxxx',\n },\n});\n```\n\nOrganization scope uses resource `AWSLogs/*` and `aws:SourceOrgID` on the log-delivery **service** principals. The regional ELBv2 account statement is not organization-conditioned (that principal is not an organization member).\n\nWire logging on the load balancer using your normal approach (for example L1 attributes or another construct). This library only configures the **bucket** and its **resource policy**.\n\n### CloudWatch Logs export archive bucket\n\nStore log data exported from CloudWatch Logs via [export tasks](https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/S3Export.html). The bucket must be in the **same Region** as the log groups you export. Create export tasks with your usual workflow (console, CLI, or API); this library configures the **bucket** and **resource policy** for same-account exports.\n\n```typescript\nimport { Stack } from 'aws-cdk-lib';\nimport { S3SecureBucket, S3SecureBucketType } from 's3-secure-bucket';\n\ndeclare const stack: Stack;\n\nconst logArchiveBucket = new S3SecureBucket(stack, 'LogArchiveBucket', {\n bucketType: S3SecureBucketType.CLOUD_WATCH_LOG_ARCHIVE_BUCKET,\n});\n```\n\nFor cross-account export, extend the bucket policy with additional `aws:SourceAccount` and `aws:SourceArn` entries per [AWS documentation](https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/S3ExportTasks.html).\n\n## Options\n\n`S3SecureBucket` accepts `S3SecureBucketProps`, which extends [`s3.BucketProps`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_s3.BucketProps.html). Standard options such as `bucketName`, `versioned`, `encryption`, `lifecycleRules`, and `eventBridgeEnabled` work as usual alongside the secure defaults. When `eventBridgeEnabled` is `true`, EventBridge notification is enabled via an L1 override on the underlying `AWS::S3::Bucket`.\n\n### Construct props (`S3SecureBucketProps`)\n\n| Property | Type | Default | Description |\n| --- | --- | --- | --- |\n| `bucketType` | `S3SecureBucketType` | `DEFAULT_BUCKET` | Selects encryption defaults and optional resource-policy statements. |\n| `accessLogDelivery` | `AccessLogDeliveryScope` | stack account only | `ACCESS_LOG_BUCKET` only. Exactly one of `allowedSourceAccountIds` or `organizationId`. |\n| *(inherited)* | `s3.BucketProps` | — | All other `Bucket` properties are passed through (some receive overrides inside the construct). |\n\n### `S3SecureBucketType` values\n\n| Constant | Use case |\n| --- | --- |\n| `S3SecureBucketType.DEFAULT_BUCKET` | General-purpose secure bucket |\n| `S3SecureBucketType.DEPLOYMENT_PIPELINE_ARTIFACT_BUCKET` | CDK pipeline artifact bucket (custom bootstrap qualifier) |\n| `S3SecureBucketType.CLOUDFRONT_ORIGIN_BUCKET` | CloudFront origin bucket |\n| `S3SecureBucketType.ACCESS_LOG_BUCKET` | Centralized access logs (`AWSLogs/<account>/*` by default; widen with `accessLogDelivery`) |\n| `S3SecureBucketType.CLOUD_WATCH_LOG_ARCHIVE_BUCKET` | CloudWatch Logs export archive |\n\n### Read-only: `accessLogBucketPolicyDependable`\n\n| Property | Type | When set | Description |\n| --- | --- | --- | --- |\n| `accessLogBucketPolicyDependable` | `IDependable \\| undefined` | `bucketType === ACCESS_LOG_BUCKET` | Depend on this from ALB/NLB so access-log configuration waits for the bucket policy resource. |\n\nSee [API.md](./API.md) for the full API reference.\n\n## Requirements\n\n- Node.js >= 20\n- Peer dependencies: `aws-cdk-lib` ^2.232.0, `constructs` ^10.5.1\n\n## License\n\nThis project is licensed under the Apache-2.0 License.\n"
8459
+ "markdown": "# S3 Secure Bucket (CDK v2)\n\n[![npm version](https://img.shields.io/npm/v/s3-secure-bucket?style=flat-square)](https://www.npmjs.com/package/s3-secure-bucket)\n[![license](https://img.shields.io/npm/l/s3-secure-bucket?style=flat-square)](https://www.npmjs.com/package/s3-secure-bucket)\n[![Node.js](https://img.shields.io/node/v/s3-secure-bucket?style=flat-square)](https://www.npmjs.com/package/s3-secure-bucket)\n[![build](https://img.shields.io/github/actions/workflow/status/gammarers-aws-cdk-resources/s3-secure-bucket/build.yml?label=build&style=flat-square)](https://github.com/gammarers-aws-cdk-resources/s3-secure-bucket/actions/workflows/build.yml)\n\n[![View on Construct Hub](https://constructs.dev/badge?package=s3-secure-bucket)](https://constructs.dev/packages/s3-secure-bucket)\n\nAWS CDK v2 construct for an Amazon S3 bucket with private access, TLS-only requests, encryption, and versioning. `bucketType` selects encryption and, where needed, a bucket policy for pipeline artifacts, CloudFront origins, access logs, or CloudWatch Logs exports.\n\n## Features\n\n- Private access, block public access, and deny insecure transport (`enforceSSL`)\n- **Default bucket**: KMS-managed encryption (`aws:kms`) unless overridden\n- **Log / origin / archive types**: S3-managed encryption (`AES256`) for `ACCESS_LOG_BUCKET`, `CLOUDFRONT_ORIGIN_BUCKET`, and `CLOUD_WATCH_LOG_ARCHIVE_BUCKET`\n- Versioning on by default; object ownership `BucketOwnerEnforced` by default\n- `RemovalPolicy.RETAIN` on the bucket\n- Optional EventBridge notifications via `eventBridgeEnabled`\n- **`bucketType` presets**\n - **`DEFAULT_BUCKET`**: general-purpose secure bucket (KMS-managed encryption by default)\n - **`DEPLOYMENT_PIPELINE_ARTIFACT_BUCKET`**: optional `s3:*` grant for the CDK deploy role when using a **non-default** bootstrap qualifier\n - **`CLOUDFRONT_ORIGIN_BUCKET`**: S3-managed encryption for a CloudFront origin. `S3BucketOrigin.withOriginAccessControl` adds `s3:GetObject` for that distribution. Call `grantCloudFrontRead` only when the distribution cannot update the bucket policy (`cloudfront.amazonaws.com`, conditioned on the distribution ARN)\n - **`ACCESS_LOG_BUCKET`**: `s3:PutObject` for ALB/NLB (`logdelivery.elasticloadbalancing.amazonaws.com` + regional **ELBv2 account** from `aws-cdk-lib/region-info` when known), CloudFront standard logging (`delivery.logs.amazonaws.com`), and S3 server access logging (`logging.s3.amazonaws.com`). Writers default to `AWSLogs/<stack account>/*`; override with `accessLogDelivery` (`allowedSourceAccountIds` or `organizationId`)\n - **`CLOUD_WATCH_LOG_ARCHIVE_BUCKET`**: `s3:GetBucketAcl` and `s3:PutObject` (`bucket-owner-full-control`) for CloudWatch Logs export tasks (`logs.<region>.amazonaws.com`, same-account log groups in the stack Region)\n- **`accessLogBucketPolicyDependable`** (access-log buckets only): use with `loadBalancer.node.addDependency(...)` so ALB/NLB access-log enablement runs after the bucket policy exists (avoids validation `PutObject` failures)\n\n## How it works\n\nCreating an `S3SecureBucket` applies private access, block public access, TLS-only requests, versioning, and `RemovalPolicy.RETAIN`. `bucketType` selects the encryption default and, for some types, a bucket policy: deploy-role access for a non-default CDK bootstrap qualifier, CloudFront `s3:GetObject` when you call `grantCloudFrontRead`, log delivery for access logs, or CloudWatch Logs export. Load balancers that write access logs should depend on `accessLogBucketPolicyDependable` so the policy exists before AWS validates the log destination.\n\n## Installation\n\n### npm\n\n```bash\nnpm install s3-secure-bucket\n```\n\n### yarn\n\n```bash\nyarn add s3-secure-bucket\n```\n\n### pnpm\n\n```bash\npnpm add s3-secure-bucket\n```\n\n## Usage\n\n### Default secure bucket\n\n```typescript\nimport { Stack } from 'aws-cdk-lib';\nimport { S3SecureBucket } from 's3-secure-bucket';\n\ndeclare const stack: Stack;\n\nconst bucket = new S3SecureBucket(stack, 'S3SecureBucket', {\n bucketName: 'example-secure-bucket',\n});\n```\n\n### CDK deployment pipeline artifact bucket\n\nWhen the stack uses a **non-default** CDK bootstrap qualifier, the construct grants `s3:*` on the bucket to the regional `cdk-<qualifier>-deploy-role`.\n\n```typescript\nimport { Stack } from 'aws-cdk-lib';\nimport { S3SecureBucket, S3SecureBucketType } from 's3-secure-bucket';\n\ndeclare const stack: Stack;\n\nconst artifactBucket = new S3SecureBucket(stack, 'ArtifactBucket', {\n bucketType: S3SecureBucketType.DEPLOYMENT_PIPELINE_ARTIFACT_BUCKET,\n});\n```\n\n### CloudFront origin bucket\n\nThe bucket stays private. CloudFront reads objects through origin access control. The bucket policy allows `s3:GetObject` for `cloudfront.amazonaws.com` only when `AWS:SourceArn` is that distribution. Put the origin access control on the distribution origin. The access control ID is not part of the bucket policy.\n\n`origins.S3BucketOrigin.withOriginAccessControl` adds that statement. Do not also call `grantCloudFrontRead` for that distribution.\n\nCall `grantCloudFrontRead` only when the distribution cannot update this bucket policy, for example when the bucket is referenced from another stack. It adds the same `s3:GetObject` statement.\n\n```typescript\nimport { Stack } from 'aws-cdk-lib';\nimport * as cloudfront from 'aws-cdk-lib/aws-cloudfront';\nimport { S3SecureBucket, S3SecureBucketType } from 's3-secure-bucket';\n\ndeclare const stack: Stack;\ndeclare const distribution: cloudfront.IDistribution;\n\nconst originBucket = new S3SecureBucket(stack, 'OriginBucket', {\n bucketType: S3SecureBucketType.CLOUDFRONT_ORIGIN_BUCKET,\n});\n\noriginBucket.grantCloudFrontRead(distribution);\n```\n\n### Centralized access log bucket (ALB / NLB / CloudFront / S3)\n\nFor `ACCESS_LOG_BUCKET`, the stack **`env.region` must be a concrete region** at synthesis time (not a token) so the regional ELBv2 log-delivery account ID can be resolved when the region is known.\n\n```typescript\nimport { Stack } from 'aws-cdk-lib';\nimport { S3SecureBucket, S3SecureBucketType } from 's3-secure-bucket';\n\ndeclare const stack: Stack;\n\nconst accessLogBucket = new S3SecureBucket(stack, 'AccessLogBucket', {\n bucketType: S3SecureBucketType.ACCESS_LOG_BUCKET,\n});\n\n// After creating your load balancer (e.g. elbv2.ApplicationLoadBalancer), depend on the bucket policy\n// so ELB's validation PutObject runs after the policy exists:\n// loadBalancer.node.addDependency(accessLogBucket.accessLogBucketPolicyDependable!);\n```\n\nTo accept logs from other accounts, set **exactly one** of the following on `accessLogDelivery` (the stack account is **not** added automatically):\n\n```typescript\nconst multiAccountLogBucket = new S3SecureBucket(stack, 'MultiAccountAccessLogBucket', {\n bucketType: S3SecureBucketType.ACCESS_LOG_BUCKET,\n accessLogDelivery: {\n allowedSourceAccountIds: ['111111111111', '222222222222'],\n },\n});\n\nconst organizationLogBucket = new S3SecureBucket(stack, 'OrganizationAccessLogBucket', {\n bucketType: S3SecureBucketType.ACCESS_LOG_BUCKET,\n accessLogDelivery: {\n organizationId: 'o-xxxxxxxxxx',\n },\n});\n```\n\nOrganization scope uses resource `AWSLogs/*` and `aws:SourceOrgID` on the log-delivery **service** principals. The regional ELBv2 account statement is not organization-conditioned (that principal is not an organization member).\n\nWire logging on the load balancer using your normal approach (for example L1 attributes or another construct). This library only configures the **bucket** and its **resource policy**.\n\n### CloudWatch Logs export archive bucket\n\nStore log data exported from CloudWatch Logs via [export tasks](https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/S3Export.html). The bucket must be in the **same Region** as the log groups you export. Create export tasks with your usual workflow (console, CLI, or API); this library configures the **bucket** and **resource policy** for same-account exports.\n\n```typescript\nimport { Stack } from 'aws-cdk-lib';\nimport { S3SecureBucket, S3SecureBucketType } from 's3-secure-bucket';\n\ndeclare const stack: Stack;\n\nconst logArchiveBucket = new S3SecureBucket(stack, 'LogArchiveBucket', {\n bucketType: S3SecureBucketType.CLOUD_WATCH_LOG_ARCHIVE_BUCKET,\n});\n```\n\nFor cross-account export, extend the bucket policy with additional `aws:SourceAccount` and `aws:SourceArn` entries per [AWS documentation](https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/S3ExportTasks.html).\n\n## Options\n\n`S3SecureBucket` accepts `S3SecureBucketProps`, which extends [`s3.BucketProps`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_s3.BucketProps.html). Standard options such as `bucketName`, `versioned`, `encryption`, `lifecycleRules`, and `eventBridgeEnabled` work as usual alongside the secure defaults. When `eventBridgeEnabled` is `true`, EventBridge notification is enabled on the bucket.\n\n### Construct props (`S3SecureBucketProps`)\n\n| Property | Type | Default | Description |\n| --- | --- | --- | --- |\n| `bucketType` | `S3SecureBucketType` | `DEFAULT_BUCKET` | Selects encryption defaults and optional resource-policy statements. |\n| `accessLogDelivery` | `AccessLogDeliveryScope` | stack account only | `ACCESS_LOG_BUCKET` only. Exactly one of `allowedSourceAccountIds` or `organizationId`. |\n| *(inherited)* | `s3.BucketProps` | — | All other `Bucket` properties are passed through (some receive overrides inside the construct). |\n\n### `S3SecureBucketType` values\n\n| Constant | Use case |\n| --- | --- |\n| `S3SecureBucketType.DEFAULT_BUCKET` | General-purpose secure bucket |\n| `S3SecureBucketType.DEPLOYMENT_PIPELINE_ARTIFACT_BUCKET` | CDK pipeline artifact bucket (custom bootstrap qualifier) |\n| `S3SecureBucketType.CLOUDFRONT_ORIGIN_BUCKET` | CloudFront origin bucket. `grantCloudFrontRead` adds `s3:GetObject` only when the distribution cannot update the bucket policy. `S3BucketOrigin.withOriginAccessControl` adds that statement itself |\n| `S3SecureBucketType.ACCESS_LOG_BUCKET` | Centralized access logs (`AWSLogs/<account>/*` by default; widen with `accessLogDelivery`) |\n| `S3SecureBucketType.CLOUD_WATCH_LOG_ARCHIVE_BUCKET` | CloudWatch Logs export archive |\n\n### Read-only: `accessLogBucketPolicyDependable`\n\n| Property | Type | When set | Description |\n| --- | --- | --- | --- |\n| `accessLogBucketPolicyDependable` | `IDependable \\| undefined` | `bucketType === ACCESS_LOG_BUCKET` | Depend on this from ALB/NLB so access-log configuration waits for the bucket policy resource. |\n\n## API\n\nSee [API.md](./API.md).\n\n## Requirements\n\n- Node.js >= 20\n- Peer dependencies: `aws-cdk-lib` ^2.232.0, `constructs` ^10.5.1\n\n## License\n\nThis project is licensed under the Apache-2.0 License.\n"
8460
8460
  },
8461
8461
  "repository": {
8462
8462
  "type": "git",
@@ -8480,7 +8480,7 @@
8480
8480
  "fqn": "s3-secure-bucket.AccessLogDeliveryScope",
8481
8481
  "kind": "interface",
8482
8482
  "locationInModule": {
8483
- "filename": "src/bucket-types/access-log-delivery-scope.ts",
8483
+ "filename": "src/core/access-log-delivery-scope.ts",
8484
8484
  "line": 10
8485
8485
  },
8486
8486
  "name": "AccessLogDeliveryScope",
@@ -8495,7 +8495,7 @@
8495
8495
  },
8496
8496
  "immutable": true,
8497
8497
  "locationInModule": {
8498
- "filename": "src/bucket-types/access-log-delivery-scope.ts",
8498
+ "filename": "src/core/access-log-delivery-scope.ts",
8499
8499
  "line": 19
8500
8500
  },
8501
8501
  "name": "allowedSourceAccountIds",
@@ -8519,7 +8519,7 @@
8519
8519
  },
8520
8520
  "immutable": true,
8521
8521
  "locationInModule": {
8522
- "filename": "src/bucket-types/access-log-delivery-scope.ts",
8522
+ "filename": "src/core/access-log-delivery-scope.ts",
8523
8523
  "line": 29
8524
8524
  },
8525
8525
  "name": "organizationId",
@@ -8529,14 +8529,14 @@
8529
8529
  }
8530
8530
  }
8531
8531
  ],
8532
- "symbolId": "src/bucket-types/access-log-delivery-scope:AccessLogDeliveryScope"
8532
+ "symbolId": "src/core/access-log-delivery-scope:AccessLogDeliveryScope"
8533
8533
  },
8534
8534
  "s3-secure-bucket.S3SecureBucket": {
8535
8535
  "assembly": "s3-secure-bucket",
8536
8536
  "base": "aws-cdk-lib.aws_s3.Bucket",
8537
8537
  "docs": {
8538
8538
  "custom": {
8539
- "remarks": "Secure defaults applied regardless of `props`:\n- `removalPolicy`: {@link RemovalPolicy.RETAIN }\n- `publicReadAccess`: `false`\n- `blockPublicAccess`: {@link s3.BlockPublicAccess.BLOCK_ALL }\n- `enforceSSL`: `true`\n- `versioned`: `true` unless explicitly set in `props`\n- `objectOwnership`: {@link s3.ObjectOwnership.BUCKET_OWNER_ENFORCED } unless overridden\n- `accessControl`: {@link s3.BucketAccessControl.PRIVATE } unless overridden\n\nBucket-type-specific behavior:\n- {@link S3SecureBucketType.DEPLOYMENT_PIPELINE_ARTIFACT_BUCKET }: may attach a deploy-role policy when a non-default bootstrap qualifier is present.\n- {@link S3SecureBucketType.ACCESS_LOG_BUCKET }: adds log-writer principals; see {@link S3SecureBucket#accessLogBucketPolicyDependable }\n and {@link S3SecureBucketProps.accessLogDelivery }.\n- {@link S3SecureBucketType.CLOUD_WATCH_LOG_ARCHIVE_BUCKET }: adds CloudWatch Logs export principals (`logs.<region>.amazonaws.com`)."
8539
+ "remarks": "Secure defaults applied regardless of `props`:\n- `removalPolicy`: {@link RemovalPolicy.RETAIN }\n- `publicReadAccess`: `false`\n- `blockPublicAccess`: {@link s3.BlockPublicAccess.BLOCK_ALL }\n- `enforceSSL`: `true`\n- `versioned`: `true` unless explicitly set in `props`\n- `objectOwnership`: {@link s3.ObjectOwnership.BUCKET_OWNER_ENFORCED } unless overridden\n- `accessControl`: {@link s3.BucketAccessControl.PRIVATE } unless overridden\n\nBucket-type-specific behavior:\n- {@link S3SecureBucketType.DEPLOYMENT_PIPELINE_ARTIFACT_BUCKET }: may attach a deploy-role policy when a non-default bootstrap qualifier is present.\n- {@link S3SecureBucketType.ACCESS_LOG_BUCKET }: adds log-writer principals; see {@link S3SecureBucket#accessLogBucketPolicyDependable }\n and {@link S3SecureBucketProps.accessLogDelivery }.\n- {@link S3SecureBucketType.CLOUD_WATCH_LOG_ARCHIVE_BUCKET }: adds CloudWatch Logs export principals (`logs.<region>.amazonaws.com`).\n- {@link S3SecureBucketType.CLOUDFRONT_ORIGIN_BUCKET }: S3-managed encryption.\n {@link S3SecureBucket#grantCloudFrontRead } allows `s3:GetObject` when the distribution cannot update this bucket policy.\n `S3BucketOrigin.withOriginAccessControl` adds that statement itself."
8540
8540
  },
8541
8541
  "remarks": "KMS-managed by default otherwise).",
8542
8542
  "stability": "stable",
@@ -8550,7 +8550,7 @@
8550
8550
  },
8551
8551
  "locationInModule": {
8552
8552
  "filename": "src/s3-secure-bucket.ts",
8553
- "line": 51
8553
+ "line": 59
8554
8554
  },
8555
8555
  "parameters": [
8556
8556
  {
@@ -8587,8 +8587,36 @@
8587
8587
  "kind": "class",
8588
8588
  "locationInModule": {
8589
8589
  "filename": "src/s3-secure-bucket.ts",
8590
- "line": 31
8590
+ "line": 34
8591
8591
  },
8592
+ "methods": [
8593
+ {
8594
+ "docs": {
8595
+ "custom": {
8596
+ "throws": "Error when `bucketType` is not {@link S3SecureBucketType.CLOUDFRONT_ORIGIN_BUCKET }."
8597
+ },
8598
+ "remarks": "Adds `s3:GetObject` for `cloudfront.amazonaws.com` when `AWS:SourceArn` is\n{@link cloudfront.IDistribution.distributionArn}. Call once per distribution.\n\n`S3BucketOrigin.withOriginAccessControl` adds this same statement. Do not call\nthis method for a distribution created with that helper.\n\nCall this method only when the distribution cannot update this bucket policy,\nfor example when the bucket is referenced from another stack.\n\nSupported only when {@link S3SecureBucketProps.bucketType} is\n{@link S3SecureBucketType.CLOUDFRONT_ORIGIN_BUCKET}.",
8599
+ "stability": "stable",
8600
+ "summary": "Allows one CloudFront distribution to read objects through origin access control."
8601
+ },
8602
+ "locationInModule": {
8603
+ "filename": "src/s3-secure-bucket.ts",
8604
+ "line": 111
8605
+ },
8606
+ "name": "grantCloudFrontRead",
8607
+ "parameters": [
8608
+ {
8609
+ "docs": {
8610
+ "summary": "- Distribution that fetches objects from this bucket."
8611
+ },
8612
+ "name": "distribution",
8613
+ "type": {
8614
+ "fqn": "aws-cdk-lib.aws_cloudfront.IDistribution"
8615
+ }
8616
+ }
8617
+ ]
8618
+ }
8619
+ ],
8592
8620
  "name": "S3SecureBucket",
8593
8621
  "properties": [
8594
8622
  {
@@ -8601,7 +8629,7 @@
8601
8629
  "immutable": true,
8602
8630
  "locationInModule": {
8603
8631
  "filename": "src/s3-secure-bucket.ts",
8604
- "line": 41
8632
+ "line": 49
8605
8633
  },
8606
8634
  "name": "accessLogBucketPolicyDependable",
8607
8635
  "optional": true,
@@ -8626,7 +8654,7 @@
8626
8654
  ],
8627
8655
  "kind": "interface",
8628
8656
  "locationInModule": {
8629
- "filename": "src/bucket-types/props.ts",
8657
+ "filename": "src/core/props.ts",
8630
8658
  "line": 11
8631
8659
  },
8632
8660
  "name": "S3SecureBucketProps",
@@ -8641,7 +8669,7 @@
8641
8669
  },
8642
8670
  "immutable": true,
8643
8671
  "locationInModule": {
8644
- "filename": "src/bucket-types/props.ts",
8672
+ "filename": "src/core/props.ts",
8645
8673
  "line": 32
8646
8674
  },
8647
8675
  "name": "accessLogDelivery",
@@ -8659,7 +8687,7 @@
8659
8687
  },
8660
8688
  "immutable": true,
8661
8689
  "locationInModule": {
8662
- "filename": "src/bucket-types/props.ts",
8690
+ "filename": "src/core/props.ts",
8663
8691
  "line": 18
8664
8692
  },
8665
8693
  "name": "bucketType",
@@ -8669,9 +8697,9 @@
8669
8697
  }
8670
8698
  }
8671
8699
  ],
8672
- "symbolId": "src/bucket-types/props:S3SecureBucketProps"
8700
+ "symbolId": "src/core/props:S3SecureBucketProps"
8673
8701
  }
8674
8702
  },
8675
- "version": "0.5.6",
8676
- "fingerprint": "t8AWbWWwDBXHXUzsTLJSwwr3YN7yT/p9UqzGEelVA7M="
8703
+ "version": "0.6.1",
8704
+ "fingerprint": "VVVMFNoAS/xmECKw64ClEw4fddWPaj+et6XBjSCilak="
8677
8705
  }
package/API.md CHANGED
@@ -85,6 +85,7 @@ When `eventBridgeEnabled` is `true`, EventBridge notification is enabled via an
85
85
  | <code><a href="#s3-secure-bucket.S3SecureBucket.addInventory">addInventory</a></code> | Add an inventory configuration. |
86
86
  | <code><a href="#s3-secure-bucket.S3SecureBucket.addLifecycleRule">addLifecycleRule</a></code> | Add a lifecycle rule to the bucket. |
87
87
  | <code><a href="#s3-secure-bucket.S3SecureBucket.addMetric">addMetric</a></code> | Adds a metrics configuration for the CloudWatch request metrics from the bucket. |
88
+ | <code><a href="#s3-secure-bucket.S3SecureBucket.grantCloudFrontRead">grantCloudFrontRead</a></code> | Allows one CloudFront distribution to read objects through origin access control. |
88
89
 
89
90
  ---
90
91
 
@@ -865,6 +866,34 @@ The metric configuration to add.
865
866
 
866
867
  ---
867
868
 
869
+ ##### `grantCloudFrontRead` <a name="grantCloudFrontRead" id="s3-secure-bucket.S3SecureBucket.grantCloudFrontRead"></a>
870
+
871
+ ```typescript
872
+ public grantCloudFrontRead(distribution: IDistribution): void
873
+ ```
874
+
875
+ Allows one CloudFront distribution to read objects through origin access control.
876
+
877
+ Adds `s3:GetObject` for `cloudfront.amazonaws.com` when `AWS:SourceArn` is
878
+ {@link cloudfront.IDistribution.distributionArn}. Call once per distribution.
879
+
880
+ `S3BucketOrigin.withOriginAccessControl` adds this same statement. Do not call
881
+ this method for a distribution created with that helper.
882
+
883
+ Call this method only when the distribution cannot update this bucket policy,
884
+ for example when the bucket is referenced from another stack.
885
+
886
+ Supported only when {@link S3SecureBucketProps.bucketType} is
887
+ {@link S3SecureBucketType.CLOUDFRONT_ORIGIN_BUCKET}.
888
+
889
+ ###### `distribution`<sup>Required</sup> <a name="distribution" id="s3-secure-bucket.S3SecureBucket.grantCloudFrontRead.parameter.distribution"></a>
890
+
891
+ - *Type:* aws-cdk-lib.aws_cloudfront.IDistribution
892
+
893
+ Distribution that fetches objects from this bucket.
894
+
895
+ ---
896
+
868
897
  #### Static Functions <a name="Static Functions" id="Static Functions"></a>
869
898
 
870
899
  | **Name** | **Description** |
package/README.md CHANGED
@@ -1,12 +1,13 @@
1
- # S3 Secure Bucket (AWS CDK v2)
1
+ # S3 Secure Bucket (CDK v2)
2
2
 
3
- [![GitHub](https://img.shields.io/github/license/gammarers-aws-cdk-resources/s3-secure-bucket?style=flat-square)](https://github.com/gammarers-aws-cdk-resources/s3-secure-bucket/blob/main/LICENSE)
4
3
  [![npm version](https://img.shields.io/npm/v/s3-secure-bucket?style=flat-square)](https://www.npmjs.com/package/s3-secure-bucket)
5
- [![GitHub Workflow Status (branch)](https://img.shields.io/github/actions/workflow/status/gammarers-aws-cdk-resources/s3-secure-bucket/build.yml?branch=main&label=build&style=flat-square)](https://github.com/gammarers-aws-cdk-resources/s3-secure-bucket/actions/workflows/build.yml)
6
- [![GitHub Workflow Status (branch)](https://img.shields.io/github/actions/workflow/status/gammarers-aws-cdk-resources/s3-secure-bucket/release.yml?branch=main&label=release&style=flat-square)](https://github.com/gammarers-aws-cdk-resources/s3-secure-bucket/actions/workflows/release.yml)
7
- [![GitHub release (latest SemVer)](https://img.shields.io/github/v/release/gammarers-aws-cdk-resources/s3-secure-bucket?sort=semver&style=flat-square)](https://github.com/gammarers-aws-cdk-resources/s3-secure-bucket/releases)
4
+ [![license](https://img.shields.io/npm/l/s3-secure-bucket?style=flat-square)](https://www.npmjs.com/package/s3-secure-bucket)
5
+ [![Node.js](https://img.shields.io/node/v/s3-secure-bucket?style=flat-square)](https://www.npmjs.com/package/s3-secure-bucket)
6
+ [![build](https://img.shields.io/github/actions/workflow/status/gammarers-aws-cdk-resources/s3-secure-bucket/build.yml?label=build&style=flat-square)](https://github.com/gammarers-aws-cdk-resources/s3-secure-bucket/actions/workflows/build.yml)
8
7
 
9
- AWS CDK v2 construct library: an [`s3.Bucket`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_s3.Bucket.html) with security-focused defaults (private ACLs, block public access, TLS-only access, encryption, versioning, `BucketOwnerEnforced`, `RemovalPolicy.RETAIN`). Use `bucketType` so encryption and bucket policies match pipeline artifacts, CloudFront origins, centralized access logs, and CloudWatch Logs export archives.
8
+ [![View on Construct Hub](https://constructs.dev/badge?package=s3-secure-bucket)](https://constructs.dev/packages/s3-secure-bucket)
9
+
10
+ AWS CDK v2 construct for an Amazon S3 bucket with private access, TLS-only requests, encryption, and versioning. `bucketType` selects encryption and, where needed, a bucket policy for pipeline artifacts, CloudFront origins, access logs, or CloudWatch Logs exports.
10
11
 
11
12
  ## Features
12
13
 
@@ -15,29 +16,39 @@ AWS CDK v2 construct library: an [`s3.Bucket`](https://docs.aws.amazon.com/cdk/a
15
16
  - **Log / origin / archive types**: S3-managed encryption (`AES256`) for `ACCESS_LOG_BUCKET`, `CLOUDFRONT_ORIGIN_BUCKET`, and `CLOUD_WATCH_LOG_ARCHIVE_BUCKET`
16
17
  - Versioning on by default; object ownership `BucketOwnerEnforced` by default
17
18
  - `RemovalPolicy.RETAIN` on the bucket
18
- - Optional EventBridge notifications via `eventBridgeEnabled` (applied through an L1 property override when `true`)
19
+ - Optional EventBridge notifications via `eventBridgeEnabled`
19
20
  - **`bucketType` presets**
20
21
  - **`DEFAULT_BUCKET`**: general-purpose secure bucket (KMS-managed encryption by default)
21
22
  - **`DEPLOYMENT_PIPELINE_ARTIFACT_BUCKET`**: optional `s3:*` grant for the CDK deploy role when using a **non-default** bootstrap qualifier
22
- - **`CLOUDFRONT_ORIGIN_BUCKET`**: S3-managed encryption for typical CloudFront origin use
23
+ - **`CLOUDFRONT_ORIGIN_BUCKET`**: S3-managed encryption for a CloudFront origin. `S3BucketOrigin.withOriginAccessControl` adds `s3:GetObject` for that distribution. Call `grantCloudFrontRead` only when the distribution cannot update the bucket policy (`cloudfront.amazonaws.com`, conditioned on the distribution ARN)
23
24
  - **`ACCESS_LOG_BUCKET`**: `s3:PutObject` for ALB/NLB (`logdelivery.elasticloadbalancing.amazonaws.com` + regional **ELBv2 account** from `aws-cdk-lib/region-info` when known), CloudFront standard logging (`delivery.logs.amazonaws.com`), and S3 server access logging (`logging.s3.amazonaws.com`). Writers default to `AWSLogs/<stack account>/*`; override with `accessLogDelivery` (`allowedSourceAccountIds` or `organizationId`)
24
25
  - **`CLOUD_WATCH_LOG_ARCHIVE_BUCKET`**: `s3:GetBucketAcl` and `s3:PutObject` (`bucket-owner-full-control`) for CloudWatch Logs export tasks (`logs.<region>.amazonaws.com`, same-account log groups in the stack Region)
25
26
  - **`accessLogBucketPolicyDependable`** (access-log buckets only): use with `loadBalancer.node.addDependency(...)` so ALB/NLB access-log enablement runs after the bucket policy exists (avoids validation `PutObject` failures)
26
27
 
28
+ ## How it works
29
+
30
+ Creating an `S3SecureBucket` applies private access, block public access, TLS-only requests, versioning, and `RemovalPolicy.RETAIN`. `bucketType` selects the encryption default and, for some types, a bucket policy: deploy-role access for a non-default CDK bootstrap qualifier, CloudFront `s3:GetObject` when you call `grantCloudFrontRead`, log delivery for access logs, or CloudWatch Logs export. Load balancers that write access logs should depend on `accessLogBucketPolicyDependable` so the policy exists before AWS validates the log destination.
31
+
27
32
  ## Installation
28
33
 
29
- **npm**
34
+ ### npm
30
35
 
31
- ```shell
36
+ ```bash
32
37
  npm install s3-secure-bucket
33
38
  ```
34
39
 
35
- **yarn**
40
+ ### yarn
36
41
 
37
- ```shell
42
+ ```bash
38
43
  yarn add s3-secure-bucket
39
44
  ```
40
45
 
46
+ ### pnpm
47
+
48
+ ```bash
49
+ pnpm add s3-secure-bucket
50
+ ```
51
+
41
52
  ## Usage
42
53
 
43
54
  ### Default secure bucket
@@ -70,18 +81,26 @@ const artifactBucket = new S3SecureBucket(stack, 'ArtifactBucket', {
70
81
 
71
82
  ### CloudFront origin bucket
72
83
 
84
+ The bucket stays private. CloudFront reads objects through origin access control. The bucket policy allows `s3:GetObject` for `cloudfront.amazonaws.com` only when `AWS:SourceArn` is that distribution. Put the origin access control on the distribution origin. The access control ID is not part of the bucket policy.
85
+
86
+ `origins.S3BucketOrigin.withOriginAccessControl` adds that statement. Do not also call `grantCloudFrontRead` for that distribution.
87
+
88
+ Call `grantCloudFrontRead` only when the distribution cannot update this bucket policy, for example when the bucket is referenced from another stack. It adds the same `s3:GetObject` statement.
89
+
73
90
  ```typescript
74
91
  import { Stack } from 'aws-cdk-lib';
92
+ import * as cloudfront from 'aws-cdk-lib/aws-cloudfront';
75
93
  import { S3SecureBucket, S3SecureBucketType } from 's3-secure-bucket';
76
94
 
77
95
  declare const stack: Stack;
96
+ declare const distribution: cloudfront.IDistribution;
78
97
 
79
98
  const originBucket = new S3SecureBucket(stack, 'OriginBucket', {
80
99
  bucketType: S3SecureBucketType.CLOUDFRONT_ORIGIN_BUCKET,
81
100
  });
82
- ```
83
101
 
84
- Wire the bucket to CloudFront (for example `origins.S3Origin`) using your usual approach. This library only configures the **bucket** defaults and encryption.
102
+ originBucket.grantCloudFrontRead(distribution);
103
+ ```
85
104
 
86
105
  ### Centralized access log bucket (ALB / NLB / CloudFront / S3)
87
106
 
@@ -143,7 +162,7 @@ For cross-account export, extend the bucket policy with additional `aws:SourceAc
143
162
 
144
163
  ## Options
145
164
 
146
- `S3SecureBucket` accepts `S3SecureBucketProps`, which extends [`s3.BucketProps`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_s3.BucketProps.html). Standard options such as `bucketName`, `versioned`, `encryption`, `lifecycleRules`, and `eventBridgeEnabled` work as usual alongside the secure defaults. When `eventBridgeEnabled` is `true`, EventBridge notification is enabled via an L1 override on the underlying `AWS::S3::Bucket`.
165
+ `S3SecureBucket` accepts `S3SecureBucketProps`, which extends [`s3.BucketProps`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_s3.BucketProps.html). Standard options such as `bucketName`, `versioned`, `encryption`, `lifecycleRules`, and `eventBridgeEnabled` work as usual alongside the secure defaults. When `eventBridgeEnabled` is `true`, EventBridge notification is enabled on the bucket.
147
166
 
148
167
  ### Construct props (`S3SecureBucketProps`)
149
168
 
@@ -159,7 +178,7 @@ For cross-account export, extend the bucket policy with additional `aws:SourceAc
159
178
  | --- | --- |
160
179
  | `S3SecureBucketType.DEFAULT_BUCKET` | General-purpose secure bucket |
161
180
  | `S3SecureBucketType.DEPLOYMENT_PIPELINE_ARTIFACT_BUCKET` | CDK pipeline artifact bucket (custom bootstrap qualifier) |
162
- | `S3SecureBucketType.CLOUDFRONT_ORIGIN_BUCKET` | CloudFront origin bucket |
181
+ | `S3SecureBucketType.CLOUDFRONT_ORIGIN_BUCKET` | CloudFront origin bucket. `grantCloudFrontRead` adds `s3:GetObject` only when the distribution cannot update the bucket policy. `S3BucketOrigin.withOriginAccessControl` adds that statement itself |
163
182
  | `S3SecureBucketType.ACCESS_LOG_BUCKET` | Centralized access logs (`AWSLogs/<account>/*` by default; widen with `accessLogDelivery`) |
164
183
  | `S3SecureBucketType.CLOUD_WATCH_LOG_ARCHIVE_BUCKET` | CloudWatch Logs export archive |
165
184
 
@@ -169,7 +188,9 @@ For cross-account export, extend the bucket policy with additional `aws:SourceAc
169
188
  | --- | --- | --- | --- |
170
189
  | `accessLogBucketPolicyDependable` | `IDependable \| undefined` | `bucketType === ACCESS_LOG_BUCKET` | Depend on this from ALB/NLB so access-log configuration waits for the bucket policy resource. |
171
190
 
172
- See [API.md](./API.md) for the full API reference.
191
+ ## API
192
+
193
+ See [API.md](./API.md).
173
194
 
174
195
  ## Requirements
175
196
 
@@ -0,0 +1,54 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isAwsOrganizationId = exports.isAwsAccountId = exports.isExclusiveAccessLogDeliveryScope = exports.hasOrganizationId = exports.hasAllowedSourceAccountIds = void 0;
4
+ /**
5
+ * Returns whether `scope` sets {@link AccessLogDeliveryScope.allowedSourceAccountIds}.
6
+ *
7
+ * @param scope - Caller-supplied delivery scope.
8
+ * @returns `true` when the account-list field is present.
9
+ */
10
+ const hasAllowedSourceAccountIds = (scope) => {
11
+ return scope.allowedSourceAccountIds !== undefined;
12
+ };
13
+ exports.hasAllowedSourceAccountIds = hasAllowedSourceAccountIds;
14
+ /**
15
+ * Returns whether `scope` sets {@link AccessLogDeliveryScope.organizationId}.
16
+ *
17
+ * @param scope - Caller-supplied delivery scope.
18
+ * @returns `true` when the organization field is present.
19
+ */
20
+ const hasOrganizationId = (scope) => {
21
+ return scope.organizationId !== undefined;
22
+ };
23
+ exports.hasOrganizationId = hasOrganizationId;
24
+ /**
25
+ * Returns whether `scope` sets exactly one of the mutually exclusive delivery fields.
26
+ *
27
+ * @param scope - Caller-supplied delivery scope.
28
+ * @returns `true` when exactly one of the two fields is present.
29
+ */
30
+ const isExclusiveAccessLogDeliveryScope = (scope) => {
31
+ return (0, exports.hasAllowedSourceAccountIds)(scope) !== (0, exports.hasOrganizationId)(scope);
32
+ };
33
+ exports.isExclusiveAccessLogDeliveryScope = isExclusiveAccessLogDeliveryScope;
34
+ /**
35
+ * Returns whether `value` is a 12-digit AWS account ID.
36
+ *
37
+ * @param value - Candidate account ID.
38
+ * @returns `true` when `value` matches `^[0-9]{12}$`.
39
+ */
40
+ const isAwsAccountId = (value) => {
41
+ return /^\d{12}$/.test(value);
42
+ };
43
+ exports.isAwsAccountId = isAwsAccountId;
44
+ /**
45
+ * Returns whether `value` is an AWS Organizations ID.
46
+ *
47
+ * @param value - Candidate organization ID.
48
+ * @returns `true` when `value` matches `^o-[a-z0-9]{10,32}$`.
49
+ */
50
+ const isAwsOrganizationId = (value) => {
51
+ return /^o-[a-z0-9]{10,32}$/.test(value);
52
+ };
53
+ exports.isAwsOrganizationId = isAwsOrganizationId;
54
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYWNjZXNzLWxvZy1kZWxpdmVyeS1zY29wZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9jb3JlL2FjY2Vzcy1sb2ctZGVsaXZlcnktc2NvcGUudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7O0FBK0JBOzs7OztHQUtHO0FBQ0ksTUFBTSwwQkFBMEIsR0FBRyxDQUFDLEtBQTZCLEVBQVcsRUFBRTtJQUNuRixPQUFPLEt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SBDYW5kaWRhdGUgYWNjb3VudCBJRC5cbiAqIEByZXR1cm5zIGB0cnVlYCB3aGVuIGB2YWx1ZWAgbWF0Y2hlcyBgXlswLTldezEyfSRgLlxuICovXG5leHBvcnQgY29uc3QgaXNBd3NBY2NvdW50SWQgPSAodmFsdWU6IHN0cmluZyk6IGJvb2xlYW4gPT4ge1xuICByZXR1cm4gL15cXGR7MTJ9JC8udGVzdCh2YWx1ZSk7XG59O1xuXG4vKipcbiAqIFJldHVybnMgd2hldGhlciBgdmFsdWVgIGlzIGFuIEFXUyBPcmdhbml6YXRpb25zIElELlxuICpcbiAqIEBwYXJhbSB2YWx1ZSAtIENhbmRpZGF0ZSBvcmdhbml6YXRpb24gSUQuXG4gKiBAcmV0dXJucyBgdHJ1ZWAgd2hlbiBgdmFsdWVgIG1hdGNoZXMgYF5vLVthLXowLTldezEwLDMyfSRgLlxuICovXG5leHBvcnQgY29uc3QgaXNBd3NPcmdhbml6YXRpb25JZCA9ICh2YWx1ZTogc3RyaW5nKTogYm9vbGVhbiA9PiB7XG4gIHJldHVybiAvXm8tW2EtejAtOV17MTAsMzJ9JC8udGVzdCh2YWx1ZSk7XG59O1xuIl19
@@ -17,6 +17,9 @@ export declare const S3SecureBucketType: {
17
17
  * Origin bucket for CloudFront distributions.
18
18
  *
19
19
  * Uses S3-managed encryption ({@link s3.BucketEncryption.S3_MANAGED}) by default.
20
+ * `S3SecureBucket.grantCloudFrontRead` allows `s3:GetObject` from one distribution
21
+ * through origin access control when that distribution cannot update this bucket policy.
22
+ * `S3BucketOrigin.withOriginAccessControl` adds the same statement itself.
20
23
  */
21
24
  readonly CLOUDFRONT_ORIGIN_BUCKET: "CloudFrontOriginBucket";
22
25
  /**
@@ -0,0 +1,54 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.S3SecureBucketType = void 0;
4
+ /**
5
+ * Bucket type discriminator values for {@link S3SecureBucketProps.bucketType}.
6
+ *
7
+ * Each value selects encryption defaults and, for some types, additional bucket resource policies.
8
+ *
9
+ * @see {@link S3SecureBucketProps.bucketType}
10
+ */
11
+ exports.S3SecureBucketType = {
12
+ /**
13
+ * Pipeline artifact bucket when using a custom CDK bootstrap qualifier
14
+ * (single- or multi-region deployments).
15
+ *
16
+ * Adds an `s3:*` grant for `cdk-<qualifier>-deploy-role` when the bootstrap qualifier is not default.
17
+ */
18
+ DEPLOYMENT_PIPELINE_ARTIFACT_BUCKET: 'DeploymentPipelineArtifactBucket',
19
+ /**
20
+ * Origin bucket for CloudFront distributions.
21
+ *
22
+ * Uses S3-managed encryption ({@link s3.BucketEncryption.S3_MANAGED}) by default.
23
+ * `S3SecureBucket.grantCloudFrontRead` allows `s3:GetObject` from one distribution
24
+ * through origin access control when that distribution cannot update this bucket policy.
25
+ * `S3BucketOrigin.withOriginAccessControl` adds the same statement itself.
26
+ */
27
+ CLOUDFRONT_ORIGIN_BUCKET: 'CloudFrontOriginBucket',
28
+ /**
29
+ * General-purpose secure bucket (default qualifier / standard use).
30
+ *
31
+ * Uses KMS-managed encryption unless overridden in props. No type-specific resource policies.
32
+ */
33
+ DEFAULT_BUCKET: 'DefaultBucket',
34
+ /**
35
+ * Centralized access logs for producers such as ALB/NLB, CloudFront standard logging (v2),
36
+ * and S3 server access logging. Grants `s3:PutObject` on `AWSLogs/...` prefixes only (no read/list).
37
+ *
38
+ * By default the prefix is `AWSLogs/<stack account>/*`. Override with
39
+ * {@link S3SecureBucketProps.accessLogDelivery} to allow an explicit account list or an AWS Organization.
40
+ *
41
+ * The regional ELBv2 log-delivery account ID (legacy path alongside the log delivery service principal)
42
+ * is resolved from `aws-cdk-lib/region-info` at synthesis time when {@link Stack#region} is known,
43
+ * or via a deploy-time mapping when it is a token.
44
+ */
45
+ ACCESS_LOG_BUCKET: 'AccessLogBucket',
46
+ /**
47
+ * Archive bucket for log data exported from CloudWatch Logs via export tasks.
48
+ *
49
+ * Grants `logs.<region>.amazonaws.com` `s3:GetBucketAcl` and `s3:PutObject` for log groups in the
50
+ * stack account and region (see AWS docs for cross-account export).
51
+ */
52
+ CLOUD_WATCH_LOG_ARCHIVE_BUCKET: 'CloudWatchLogArchiveBucket',
53
+ };
54
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYnVja2V0LXR5cGUuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvY29yZS9idWNrZXQtdHlwZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFBQTs7Ozs7O0dBTUc7QUFDVSxRQUFBLGtCQUFrQixHQUFHO0lBQ2hDOzs7OztPQUtHO0lBQ0gsbUNBQW1DLEVBQUUsa0NBQWtDO0lBQ3ZFOzs7Ozs7O09BT0c7SUFDSCx3QkFBd0IsRUFBRSx3QkFBd0I7SUFDbEQ7Ozs7T0FJRztJQUNILGNBQWMsRUFBRSxlQUFlO0lBQy9COzs7Ozs7Ozs7O09BVUc7SUFDSCxpQkFBaUIsRUFBRSxpQkFBaUI7SUFDcEM7Ozs7O09BS0c7SUFDSCw4QkFBOEIsRUFBRSw0QkFBNEI7Q0FDcEQsQ0FBQyIsInNvdXJjZXNDb250ZW50IjpbIi8qKlxuICogQnVja2V0IHR5cGUgZGlzY3JpbWluYXRvciB2YWx1ZXMgZm9yIHtAbGluayBTM1NlY3VyZUJ1Y2tldFByb3BzLmJ1Y2tldFR5cGV9LlxuICpcbiAqIEVhY2ggdmFsdWUgc2VsZWN0cyBlbmNyeXB0aW9uIGRlZmF1bHRzIGFuZCwgZm9yIHNvbWUgdHlwZXMsIGFkZGl0aW9uYWwgYnVja2V0IHJlc291cmNlIHBvbGljaWVzLlxuICpcbiAqIEBzZWUge0BsaW5rIFMzU2VjdXJlQnVja2V0UHJvcHMuYnVja2V0VHlwZX1cbiAqL1xuZXhwb3J0IGNvbnN0IFMzU2VjdXJlQnVja2V0VHlwZSA9IHtcbiAgLyoqXG4gICAqIFBpcGVsaW5lIG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Brbm93bixcbiAgICogb3IgdmlhIGEgZGVwbG95LXRpbWUgbWFwcGluZyB3aGVuIGl0IGlzIGEgdG9rZW4uXG4gICAqL1xuICBBQ0NFU1NfTE9HX0JVQ0tFVDogJ0FjY2Vzc0xvZ0J1Y2tldCcsXG4gIC8qKlxuICAgKiBBcmNoaXZlIGJ1Y2tldCBmb3IgbG9nIGRhdGEgZXhwb3J0ZWQgZnJvbSBDbG91ZFdhdGNoIExvZ3MgdmlhIGV4cG9ydCB0YXNrcy5cbiAgICpcbiAgICogR3JhbnRzIGBsb2dzLjxyZWdpb24+LmFtYXpvbmF3cy5jb21gIGBzMzpHZXRCdWNrZXRBY2xgIGFuZCBgczM6UHV0T2JqZWN0YCBmb3IgbG9nIGdyb3VwcyBpbiB0aGVcbiAgICogc3RhY2sgYWNjb3VudCBhbmQgcmVnaW9uIChzZWUgQVdTIGRvY3MgZm9yIGNyb3NzLWFjY291bnQgZXhwb3J0KS5cbiAgICovXG4gIENMT1VEX1dBVENIX0xPR19BUkNISVZFX0JVQ0tFVDogJ0Nsb3VkV2F0Y2hMb2dBcmNoaXZlQnVja2V0Jyxcbn0gYXMgY29uc3Q7XG5cbi8qKlxuICogRGlzY3JpbWluYXRlZCB1bmlvbiBvZiB7QGxpbmsgUzNTZWN1cmVCdWNrZXRUeXBlfSBzdHJpbmcgbGl0ZXJhbHMuXG4gKi9cbmV4cG9ydCB0eXBlIFMzU2VjdXJlQnVja2V0VHlwZSA9IHR5cGVvZiBTM1NlY3VyZUJ1Y2tldFR5cGVba2V5b2YgdHlwZW9mIFMzU2VjdXJlQnVja2V0VHlwZV07XG4iXX0=
@@ -56,4 +56,4 @@ const resolveEncryptionDefault = (bucketType, propsEncryption) => {
56
56
  return propsEncryption ?? s3.BucketEncryption.KMS_MANAGED;
57
57
  };
58
58
  exports.resolveEncryptionDefault = resolveEncryptionDefault;
59
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZW5jcnlwdG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