Is it possible to create AWS S3 Glacier vault in CDK app by using TypeScript? I don't see TypeScript option in the developer guide:
Here is my package.json
file.
{
"name": "cdk-app-2",
"version": "0.1.0",
"bin": {
"cdk-app-2": "bin/cdk-app-2.js"
},
"scripts": {
"build": "tsc",
"watch": "tsc -w",
"test": "jest",
"cdk": "cdk"
},
"devDependencies": {
"@types/jest": "^27.5.2",
"@types/node": "10.17.27",
"@types/prettier": "2.6.0",
"aws-cdk": "2.50.0",
"jest": "^27.5.1",
"ts-jest": "^27.1.4",
"ts-node": "^10.9.1",
"typescript": "~3.9.7"
},
"dependencies": {
"@aws-sdk/client-glacier": "^3.204.0",
"aws-cdk-lib": "2.50.0",
"constructs": "^10.0.0",
"source-map-support": "^0.5.21"
}
}
CodePudding user response:
S3 Glacier is not supported in either the CDK or CloudFormation.
As a workaround, add a Custom Resource construct. The Custom Resource's job is to call the SDK APIs to create/update/delete the vault. It will be invoked during the deployment lifecycle by CloudFormation. There are several flavours of Custom Resource. You may be able to use the custom_resources.AwsCustomResource construct, which makes SDK calls easy. If more control is required, you will need to write your own Lambda in conjunction with a cdk.CustomResource.