📝 en ~ 1 min read
What is AWS Cloud Development Kit (CDK)
Share this post
// 1️⃣ Resources are imported from 'aws-cdk-lib'import { App, Stack, StackProps } from 'aws-cdk-lib';import * as s3 from 'aws-cdk-lib/aws-s3';
// 2️⃣ Definition of the stack to be provisionedexport class MyStack extends Stack { constructor(scope: App, id: string, props?: StackProps) { super(scope, id, props);
// 3️⃣ Creates a bucket, using this L3 construct for S3 resources const myBucket = new s3.Bucket(this, 'my-bucket'); }}
// 4️⃣ App instantiationconst app = new App();
// 5️⃣ Stack instantiationnew MyStack(app, `cdk-stack-dev`, { stackName: `cdk-stack-dev`, env: {region: process.env.CDK_DEFAULT_REGION},});Constructs
Section titled %5Bobject%20Undefined%5Dimport * as s3 from 'aws-cdk-lib/aws-s3';
const myBucket = new s3.Bucket(this, 'my-bucket', { blockPublicAccess: BlockPublicAccess.BLOCK_ALL, bucketName: ``, // ⚠️ Here is defined the s3 bucket name encryption: BucketEncryption.S3_MANAGED, enforceSSL: true, eventBridgeEnabled: true, removalPolicy: RemovalPolicy.RETAIN, versioned: true,});