class Size
| Language | Type name |
|---|---|
.NET | Amazon.CDK.Size |
Java | software.amazon.awscdk.core.Size |
Python | aws_cdk.core.Size |
TypeScript (source) | @aws-cdk/core » Size |
Represents the amount of digital storage.
The amount can be specified either as a literal value (e.g: 10) which
cannot be negative, or as an unresolved number token.
When the amount is passed as a token, unit conversion is not possible.
Example
// Provide a Lambda function that will transform records before delivery, with custom
// buffering and retry configuration
const lambdaFunction = new lambda.Function(this, 'Processor', {
runtime: lambda.Runtime.NODEJS_14_X,
handler: 'index.handler',
code: lambda.Code.fromAsset(path.join(__dirname, 'process-records')),
});
const lambdaProcessor = new firehose.LambdaFunctionProcessor(lambdaFunction, {
bufferInterval: Duration.minutes(5),
bufferSize: Size.mebibytes(5),
retries: 5,
});
declare const bucket: s3.Bucket;
const s3Destination = new destinations.S3Bucket(bucket, {
processor: lambdaProcessor,
});
new firehose.DeliveryStream(this, 'Delivery Stream', {
destinations: [s3Destination],
});
Methods
| Name | Description |
|---|---|
| is | Checks if size is a token or a resolvable object. |
| to | Return this storage as a total number of gibibytes. |
| to | Return this storage as a total number of kibibytes. |
| to | Return this storage as a total number of mebibytes. |
| to | Return this storage as a total number of pebibytes. |
| to | Return this storage as a total number of tebibytes. |
| static gibibytes(amount) | Create a Storage representing an amount gibibytes. |
| static kibibytes(amount) | Create a Storage representing an amount kibibytes. |
| static mebibytes(amount) | Create a Storage representing an amount mebibytes. |
| static pebibyte(amount) | Create a Storage representing an amount pebibytes. |
| static pebibytes(amount) | Create a Storage representing an amount pebibytes. |
| static tebibytes(amount) | Create a Storage representing an amount tebibytes. |
isUnresolved()
public isUnresolved(): boolean
Returns
boolean
Checks if size is a token or a resolvable object.
toGibibytes(opts?)
public toGibibytes(opts?: SizeConversionOptions): number
Parameters
- opts
Size— the conversion options.Conversion Options
Returns
number
Return this storage as a total number of gibibytes.
toKibibytes(opts?)
public toKibibytes(opts?: SizeConversionOptions): number
Parameters
- opts
Size— the conversion options.Conversion Options
Returns
number
Return this storage as a total number of kibibytes.
toMebibytes(opts?)
public toMebibytes(opts?: SizeConversionOptions): number
Parameters
- opts
Size— the conversion options.Conversion Options
Returns
number
Return this storage as a total number of mebibytes.
toPebibytes(opts?)
public toPebibytes(opts?: SizeConversionOptions): number
Parameters
- opts
Size— the conversion options.Conversion Options
Returns
number
Return this storage as a total number of pebibytes.
toTebibytes(opts?)
public toTebibytes(opts?: SizeConversionOptions): number
Parameters
- opts
Size— the conversion options.Conversion Options
Returns
number
Return this storage as a total number of tebibytes.
static gibibytes(amount)
public static gibibytes(amount: number): Size
Parameters
- amount
number— the amount of gibibytes to be represented.
Returns
Create a Storage representing an amount gibibytes.
1 GiB = 1024 MiB
static kibibytes(amount)
public static kibibytes(amount: number): Size
Parameters
- amount
number— the amount of kibibytes to be represented.
Returns
Create a Storage representing an amount kibibytes.
1 KiB = 1024 bytes
static mebibytes(amount)
public static mebibytes(amount: number): Size
Parameters
- amount
number— the amount of mebibytes to be represented.
Returns
Create a Storage representing an amount mebibytes.
1 MiB = 1024 KiB
static pebibyte(amount)
public static pebibyte(amount: number): Size
⚠️ Deprecated: use pebibytes instead
Parameters
- amount
number
Returns
Create a Storage representing an amount pebibytes.
1 PiB = 1024 TiB
static pebibytes(amount)
public static pebibytes(amount: number): Size
Parameters
- amount
number— the amount of pebibytes to be represented.
Returns
Create a Storage representing an amount pebibytes.
1 PiB = 1024 TiB
static tebibytes(amount)
public static tebibytes(amount: number): Size
Parameters
- amount
number— the amount of tebibytes to be represented.
Returns
Create a Storage representing an amount tebibytes.
1 TiB = 1024 GiB

.NET
Java
Python
TypeScript (