Skip to content
v2.274.0

StorageClass Class ​

Storage class to move an object to.

Example ​

ts
const bucket = new s3.Bucket(this, 'MyBucket', {
  lifecycleRules: [
    {
      abortIncompleteMultipartUploadAfter: Duration.minutes(30),
      enabled: false,
      expiration: Duration.days(30),
      expirationDate: new Date(),
      expiredObjectDeleteMarker: false,
      id: 'id',
      noncurrentVersionExpiration: Duration.days(30),

      // the properties below are optional
      noncurrentVersionsToRetain: 123,
      noncurrentVersionTransitions: [
        {
          storageClass: s3.StorageClass.GLACIER,
          transitionAfter: Duration.days(30),

          // the properties below are optional
          noncurrentVersionsToRetain: 123,
        },
      ],
      objectSizeGreaterThan: 500,
      prefix: 'prefix',
      objectSizeLessThan: 10000,
      transitions: [
        {
          storageClass: s3.StorageClass.GLACIER,

          // exactly one of transitionAfter or transitionDate must be specified
          transitionAfter: Duration.days(30),
          // transitionDate: new Date(), // cannot specify both
        },
      ],
    },
  ],
});
python
bucket = s3.Bucket(self, "MyBucket",
    lifecycle_rules=[s3.LifecycleRule(
        abort_incomplete_multipart_upload_after=Duration.minutes(30),
        enabled=False,
        expiration=Duration.days(30),
        expiration_date=Date(),
        expired_object_delete_marker=False,
        id="id",
        noncurrent_version_expiration=Duration.days(30),

        # the properties below are optional
        noncurrent_versions_to_retain=123,
        noncurrent_version_transitions=[s3.NoncurrentVersionTransition(
            storage_class=s3.StorageClass.GLACIER,
            transition_after=Duration.days(30),

            # the properties below are optional
            noncurrent_versions_to_retain=123
        )
        ],
        object_size_greater_than=500,
        prefix="prefix",
        object_size_less_than=10000,
        transitions=[s3.Transition(
            storage_class=s3.StorageClass.GLACIER,

            # exactly one of transitionAfter or transitionDate must be specified
            transition_after=Duration.days(30)
        )
        ]
    )
    ]
)
java
Bucket bucket = Bucket.Builder.create(this, "MyBucket")
        .lifecycleRules(List.of(LifecycleRule.builder()
                .abortIncompleteMultipartUploadAfter(Duration.minutes(30))
                .enabled(false)
                .expiration(Duration.days(30))
                .expirationDate(new Date())
                .expiredObjectDeleteMarker(false)
                .id("id")
                .noncurrentVersionExpiration(Duration.days(30))

                // the properties below are optional
                .noncurrentVersionsToRetain(123)
                .noncurrentVersionTransitions(List.of(NoncurrentVersionTransition.builder()
                        .storageClass(StorageClass.GLACIER)
                        .transitionAfter(Duration.days(30))

                        // the properties below are optional
                        .noncurrentVersionsToRetain(123)
                        .build()))
                .objectSizeGreaterThan(500)
                .prefix("prefix")
                .objectSizeLessThan(10000)
                .transitions(List.of(Transition.builder()
                        .storageClass(StorageClass.GLACIER)

                        // exactly one of transitionAfter or transitionDate must be specified
                        .transitionAfter(Duration.days(30))
                        .build()))
                .build()))
        .build();
csharp
// Install: dotnet add package Amazon.CDK.Lib
var bucket = new Bucket(this, "MyBucket", new BucketProps {
    LifecycleRules = new [] { new LifecycleRule {
        AbortIncompleteMultipartUploadAfter = Duration.Minutes(30),
        Enabled = false,
        Expiration = Duration.Days(30),
        ExpirationDate = new Date(),
        ExpiredObjectDeleteMarker = false,
        Id = "id",
        NoncurrentVersionExpiration = Duration.Days(30),

        // the properties below are optional
        NoncurrentVersionsToRetain = 123,
        NoncurrentVersionTransitions = new [] { new NoncurrentVersionTransition {
            StorageClass = StorageClass.GLACIER,
            TransitionAfter = Duration.Days(30),

            // the properties below are optional
            NoncurrentVersionsToRetain = 123
        } },
        ObjectSizeGreaterThan = 500,
        Prefix = "prefix",
        ObjectSizeLessThan = 10000,
        Transitions = new [] { new Transition {
            StorageClass = StorageClass.GLACIER,

            // exactly one of transitionAfter or transitionDate must be specified
            TransitionAfter = Duration.Days(30)
        } }
    } }
});
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
bucket := s3.NewBucket(this, jsii.String("MyBucket"), &BucketProps{
	LifecycleRules: []LifecycleRule{
		&LifecycleRule{
			AbortIncompleteMultipartUploadAfter: awscdk.Duration_Minutes(jsii.Number(30)),
			Enabled: jsii.Boolean(false),
			Expiration: awscdk.Duration_Days(jsii.Number(30)),
			ExpirationDate: NewDate(),
			ExpiredObjectDeleteMarker: jsii.Boolean(false),
			Id: jsii.String("id"),
			NoncurrentVersionExpiration: awscdk.Duration_*Days(jsii.Number(30)),

			// the properties below are optional
			NoncurrentVersionsToRetain: jsii.Number(123),
			NoncurrentVersionTransitions: []NoncurrentVersionTransition{
				&NoncurrentVersionTransition{
					StorageClass: s3.StorageClass_GLACIER(),
					TransitionAfter: awscdk.Duration_*Days(jsii.Number(30)),

					// the properties below are optional
					NoncurrentVersionsToRetain: jsii.Number(123),
				},
			},
			ObjectSizeGreaterThan: jsii.Number(500),
			Prefix: jsii.String("prefix"),
			ObjectSizeLessThan: jsii.Number(10000),
			Transitions: []Transition{
				&Transition{
					StorageClass: s3.StorageClass_GLACIER(),

					// exactly one of transitionAfter or transitionDate must be specified
					TransitionAfter: awscdk.Duration_*Days(jsii.Number(30)),
				},
			},
		},
	},
})

Initializer ​

ts
new StorageClass(value: string)
python
StorageClass(value: str)
java
new StorageClass(String value)
csharp
new StorageClass(string value)
go
NewStorageClass(Value *string)

Properties ​

DEEP_ARCHIVEStorageClassdeep_archiveStorageClassDEEP_ARCHIVEStorageClassDEEP_ARCHIVEStorageClassDEEP_ARCHIVEStorageClassrequiredstatic#
Use for archiving data that rarely needs to be accessed.
notes

Data stored in the DEEP_ARCHIVE storage class has a minimum storage duration period of 180 days and a default retrieval time of 12 hours. If you delete an object before the 180-day minimum, you are charged for 180 days. For pricing information, see Amazon S3 Pricing.

GLACIERStorageClassglacierStorageClassGLACIERStorageClassGLACIERStorageClassGLACIERStorageClassrequiredstatic#
Storage class for long-term archival that can take between minutes and hours to access.
notes

Use for archives where portions of the data might need to be retrieved in minutes. Data stored in the GLACIER storage class has a minimum storage duration period of 90 days and can be accessed in as little as 1-5 minutes using expedited retrieval. If you delete an object before the 90-day minimum, you are charged for 90 days.

GLACIER_INSTANT_RETRIEVALStorageClassglacier_instant_retrievalStorageClassGLACIER_INSTANT_RETRIEVALStorageClassGLACIER_INSTANT_RETRIEVALStorageClassGLACIER_INSTANT_RETRIEVALStorageClassrequiredstatic#
Storage class for long-term archival that can be accessed in a few milliseconds.
notes

It is ideal for data that is accessed once or twice per quarter, and that requires immediate access. Data stored in the GLACIER_IR storage class has a minimum storage duration period of 90 days and can be accessed in as milliseconds. If you delete an object before the 90-day minimum, you are charged for 90 days.

INFREQUENT_ACCESSStorageClassinfrequent_accessStorageClassINFREQUENT_ACCESSStorageClassINFREQUENT_ACCESSStorageClassINFREQUENT_ACCESSStorageClassrequiredstatic#
Storage class for data that is accessed less frequently, but requires rapid access when needed.

Has lower availability than Standard storage.

INTELLIGENT_TIERINGStorageClassintelligent_tieringStorageClassINTELLIGENT_TIERINGStorageClassINTELLIGENT_TIERINGStorageClassINTELLIGENT_TIERINGStorageClassrequiredstatic#
The INTELLIGENT_TIERING storage class is designed to optimize storage costs by automatically moving data to the most cost-effective storage access tier, without performance impact or operational overhead.
notes

INTELLIGENT_TIERING delivers automatic cost savings by moving data on a granular object level between two access tiers, a frequent access tier and a lower-cost infrequent access tier, when access patterns change. The INTELLIGENT_TIERING storage class is ideal if you want to optimize storage costs automatically for long-lived data when access patterns are unknown or unpredictable.

ONE_ZONE_INFREQUENT_ACCESSStorageClassone_zone_infrequent_accessStorageClassONE_ZONE_INFREQUENT_ACCESSStorageClassONE_ZONE_INFREQUENT_ACCESSStorageClassONE_ZONE_INFREQUENT_ACCESSStorageClassrequiredstatic#
Infrequent Access that's only stored in one availability zone.

Has lower availability than standard InfrequentAccess.

valuestringvaluestrvalueStringValuestringValue*stringrequired#

Methods ​

toString(): stringdef to_string(self, ) -> strpublic String toString()public string ToString()func ToString() *string#