-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathbasic-usage.ts
More file actions
38 lines (31 loc) · 1.09 KB
/
Copy pathbasic-usage.ts
File metadata and controls
38 lines (31 loc) · 1.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/usr/bin/env node
import 'source-map-support/register';
import { App, Stack } from 'aws-cdk-lib';
import { SecureBucket, SecurityLevel } from '../src';
/**
* Basic usage example for AWS CDK Secure Constructs
*
* This example demonstrates how to create a secure S3 bucket
* with all security best practices enabled by default.
*/
const app = new App();
class SecureBucketStack extends Stack {
constructor(scope: App, id: string) {
super(scope, id);
// Create a secure S3 bucket with default security settings (HIGH tier).
// CIS-critical settings (encryption, SSL, block-public-access, object
// ownership) are always enforced regardless of the chosen tier.
const secureBucket = new SecureBucket(this, 'MySecureBucket', {
bucketName: 'my-secure-bucket-example',
securityLevel: SecurityLevel.HIGH,
enableAccessLogging: true,
});
// Output the bucket name for reference
this.exportValue(secureBucket.bucket.bucketName, {
name: 'SecureBucketName',
});
}
}
// Create the stack
new SecureBucketStack(app, 'SecureBucketExampleStack');
app.synth();