# NoncurrentVersionExpirationProperty

Specifies when noncurrent object versions expire.

Upon expiration, Amazon S3 permanently deletes the noncurrent object versions. You set this lifecycle configuration action on a bucket that has versioning enabled (or suspended) to request that Amazon S3 delete noncurrent object versions at a specific period in the object's lifetime. For more information about setting a lifecycle rule configuration, see [AWS::S3::Bucket Rule](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-bucket-lifecycleconfig-rule.html) .

- 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_s3 as s3 } from 'aws-cdk-lib';
const noncurrentVersionExpirationProperty: s3.CfnBucket.NoncurrentVersionExpirationProperty = {
  noncurrentDays: 123,

  // the properties below are optional
  newerNoncurrentVersions: 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_s3 as s3

noncurrent_version_expiration_property = s3.CfnBucket.NoncurrentVersionExpirationProperty(
    noncurrent_days=123,

    # the properties below are optional
    newer_noncurrent_versions=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.s3.*;

NoncurrentVersionExpirationProperty noncurrentVersionExpirationProperty = NoncurrentVersionExpirationProperty.builder()
        .noncurrentDays(123)

        // the properties below are optional
        .newerNoncurrentVersions(123)
        .build();
```

C# / .NET:

```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.S3;

var noncurrentVersionExpirationProperty = new NoncurrentVersionExpirationProperty {
    NoncurrentDays = 123,

    // the properties below are optional
    NewerNoncurrentVersions = 123
};
```

Golang:

```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"

noncurrentVersionExpirationProperty := &NoncurrentVersionExpirationProperty{
	NoncurrentDays: jsii.Number(123),

	// the properties below are optional
	NewerNoncurrentVersions: jsii.Number(123),
}
```

## Properties

- `newerNoncurrentVersions`: number — Specifies how many noncurrent versions Amazon S3 will retain.

  If there are this many more recent noncurrent versions, Amazon S3 will take the associated action. For more information about noncurrent versions, see [Lifecycle configuration elements](https://docs.aws.amazon.com/AmazonS3/latest/userguide/intro-lifecycle-rules.html) in the *Amazon S3 User Guide* .

- `noncurrentDays`: number (required) — Specifies the number of days an object is noncurrent before Amazon S3 can perform the associated action.

  For information about the noncurrent days calculations, see [How Amazon S3 Calculates When an Object Became Noncurrent](https://docs.aws.amazon.com/AmazonS3/latest/dev/intro-lifecycle-rules.html#non-current-days-calculations) in the *Amazon S3 User Guide* .
