# MaxCountRuleProperty

Struct · External

Use the `MaxAgeRule` property type to specify a max count rule to restrict the number of application versions that are retained for an AWS Elastic Beanstalk application when defining an AWS::ElasticBeanstalk::Application resource in an AWS CloudFormation template.

A lifecycle rule that deletes the oldest application version when the maximum count is exceeded.

`MaxCountRule` is a property of the [ApplicationVersionLifecycleConfig](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticbeanstalk-application-applicationversionlifecycleconfig.html) property type.

- Source: Generated at build time
- Type last changed: v2.93.0 · 23 Aug 2023

## Example

TypeScript:

```ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_elasticbeanstalk as elasticbeanstalk } from 'aws-cdk-lib';
const maxCountRuleProperty: elasticbeanstalk.CfnApplication.MaxCountRuleProperty = {
  deleteSourceFromS3: false,
  enabled: false,
  maxCount: 123,
};
```

Python:

```python
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_elasticbeanstalk as elasticbeanstalk

max_count_rule_property = elasticbeanstalk.CfnApplication.MaxCountRuleProperty(
    delete_source_from_s3=False,
    enabled=False,
    max_count=123
)
```

Java:

```java
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.services.elasticbeanstalk.*;

MaxCountRuleProperty maxCountRuleProperty = MaxCountRuleProperty.builder()
        .deleteSourceFromS3(false)
        .enabled(false)
        .maxCount(123)
        .build();
```

C#:

```csharp
// Install: dotnet add package Amazon.CDK.Lib
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK.AWS.ElasticBeanstalk;

var maxCountRuleProperty = new MaxCountRuleProperty {
    DeleteSourceFromS3 = false,
    Enabled = false,
    MaxCount = 123
};
```

Go:

```go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import "github.com/aws/aws-cdk-go/awscdk"

maxCountRuleProperty := &MaxCountRuleProperty{
	DeleteSourceFromS3: jsii.Boolean(false),
	Enabled: jsii.Boolean(false),
	MaxCount: jsii.Number(123),
}
```

## Properties

- `deleteSourceFromS3`: boolean | [IResolvable](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.IResolvable.html) — Set to `true` to delete a version's source bundle from Amazon S3 when Elastic Beanstalk deletes the application version.

- `enabled`: boolean | [IResolvable](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.IResolvable.html) — Specify `true` to apply the rule, or `false` to disable it.

- `maxCount`: number — Specify the maximum number of application versions to retain.
