1 Respuesta
- Más nuevo
- Más votos
- Más comentarios
5
By default, CDK will (generally) apply a RemovalPolicy value of RETAIN to stateful resources which could contain data in order to avoid deleting it when destroying the stack.
You can see this in the synthesised template. For example, with this resource declared in CDK:
const table = new ddb.Table(this, "testTable", {
partitionKey: { type: AttributeType.STRING, name: 'id' },
});
the synthesised template will contain the following:
"testTableFD9E8557": {
"Type": "AWS::DynamoDB::Table",
"Properties": {
[snip]
},
"UpdateReplacePolicy": "Retain",
"DeletionPolicy": "Retain",
[snip]
},
The CloudFormation UpdateReplacePolicy and DeletionPolicy attributes being Retain
will cause CloudFormation to leave the resource intact when deleting the stack.
To have the resource deleted when the stack is deleted (when you run cdk destroy
), specify a RemovalPolicy of DESTROY
or SNAPSHOT
in your code:
const table = new ddb.Table(this, "testTable", {
partitionKey: { type: AttributeType.STRING, name: 'id' },
removalPolicy: RemovalPolicy.DESTROY,
});
giving this CFN template:
"testTableFD9E8557": {
"Type": "AWS::DynamoDB::Table",
"Properties": {
[snip]
},
"UpdateReplacePolicy": "Delete",
"DeletionPolicy": "Delete",
[snip]
},
Contenido relevante
- Como solucionar el error: Supplied Policy document is breaching Cloudwatch Logs policy length limit.Respuesta aceptadapreguntada hace 14 días
- preguntada hace 7 días
- preguntada hace un mes
- preguntada hace un mes
- ¿Cómo puedo hacer una llamada al SDK de AWS desde un proyecto de CDK mediante la interfaz AWSdkCall?OFICIAL DE AWSActualizada hace 2 años
- OFICIAL DE AWSActualizada hace 2 años
- OFICIAL DE AWSActualizada hace 8 meses