# DeletionProtection

Deletion protection level for Auto Scaling group.

- Source: [`aws-autoscaling/lib/auto-scaling-group.ts`](https://github.com/aws/aws-cdk/blob/v2.278.0/packages/aws-cdk-lib/aws-autoscaling/lib/auto-scaling-group.ts#L79)
- Type last changed: v2.241.0 · 2 Mar 2026

## Example

TypeScript:

```ts
declare const vpc: ec2.Vpc;

new autoscaling.AutoScalingGroup(this, 'ASG', {
  vpc,
  instanceType: ec2.InstanceType.of(ec2.InstanceClass.T3, ec2.InstanceSize.MICRO),
  machineImage: ec2.MachineImage.latestAmazonLinux2(),
  deletionProtection: autoscaling.DeletionProtection.PREVENT_ALL_DELETION,
});
```

Python:

```python
# vpc: ec2.Vpc

autoscaling.AutoScalingGroup(self, "ASG",
    vpc=vpc,
    instance_type=ec2.InstanceType.of(ec2.InstanceClass.T3, ec2.InstanceSize.MICRO),
    machine_image=ec2.MachineImage.latest_amazon_linux2(),
    deletion_protection=autoscaling.DeletionProtection.PREVENT_ALL_DELETION
)
```

Java:

```java
Vpc vpc;

AutoScalingGroup.Builder.create(this, "ASG")
        .vpc(vpc)
        .instanceType(InstanceType.of(InstanceClass.T3, InstanceSize.MICRO))
        .machineImage(MachineImage.latestAmazonLinux2())
        .deletionProtection(DeletionProtection.PREVENT_ALL_DELETION)
        .build();
```

C# / .NET:

```csharp
// Install: dotnet add package Amazon.CDK.Lib
Vpc vpc;

new AutoScalingGroup(this, "ASG", new AutoScalingGroupProps {
    Vpc = vpc,
    InstanceType = InstanceType.Of(InstanceClass.T3, InstanceSize.MICRO),
    MachineImage = MachineImage.LatestAmazonLinux2(),
    DeletionProtection = DeletionProtection.PREVENT_ALL_DELETION
});
```

Golang:

```go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
var vpc Vpc

autoscaling.NewAutoScalingGroup(this, jsii.String("ASG"), &AutoScalingGroupProps{
	Vpc: Vpc,
	InstanceType: ec2.InstanceType_Of(ec2.InstanceClass_T3, ec2.InstanceSize_MICRO),
	MachineImage: ec2.MachineImage_LatestAmazonLinux2(),
	DeletionProtection: autoscaling.DeletionProtection_PREVENT_ALL_DELETION,
})
```

## Members

| Member | Description |
| --- | --- |
| `NONE` | No deletion protection. |
| `PREVENT_FORCE_DELETION` | Block force delete operations. |
| `PREVENT_ALL_DELETION` | Block all delete operations. |

## Referenced by

- [`CommonAutoScalingGroupProps`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_autoscaling.CommonAutoScalingGroupProps.html).deletionProtection
