Size

class aws_cdk.core.Size(*args, **kwargs)

Bases: object

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.

Methods

to_gibibytes(*, rounding=None)

Return this storage as a total number of gibibytes.

Parameters

rounding (Optional[SizeRoundingBehavior]) – How conversions should behave when it encounters a non-integer result. Default: SizeRoundingBehavior.FAIL

Return type

Union[int, float]

Returns

the quantity of bytes expressed in gibibytes

to_kibibytes(*, rounding=None)

Return this storage as a total number of kibibytes.

Parameters

rounding (Optional[SizeRoundingBehavior]) – How conversions should behave when it encounters a non-integer result. Default: SizeRoundingBehavior.FAIL

Return type

Union[int, float]

Returns

the quantity of bytes expressed in kibibytes

to_mebibytes(*, rounding=None)

Return this storage as a total number of mebibytes.

Parameters

rounding (Optional[SizeRoundingBehavior]) – How conversions should behave when it encounters a non-integer result. Default: SizeRoundingBehavior.FAIL

Return type

Union[int, float]

Returns

the quantity of bytes expressed in mebibytes

to_pebibytes(*, rounding=None)

Return this storage as a total number of pebibytes.

Parameters

rounding (Optional[SizeRoundingBehavior]) – How conversions should behave when it encounters a non-integer result. Default: SizeRoundingBehavior.FAIL

Return type

Union[int, float]

Returns

the quantity of bytes expressed in pebibytes

to_tebibytes(*, rounding=None)

Return this storage as a total number of tebibytes.

Parameters

rounding (Optional[SizeRoundingBehavior]) – How conversions should behave when it encounters a non-integer result. Default: SizeRoundingBehavior.FAIL

Return type

Union[int, float]

Returns

the quantity of bytes expressed in tebibytes

Static Methods

classmethod gibibytes(amount)

Create a Storage representing an amount gibibytes.

1 GiB = 1024 MiB

Parameters

amount (Union[int, float]) – the amount of gibibytes to be represented.

Return type

Size

Returns

a new Size instance

classmethod kibibytes(amount)

Create a Storage representing an amount kibibytes.

1 KiB = 1024 bytes

Parameters

amount (Union[int, float]) – the amount of kibibytes to be represented.

Return type

Size

Returns

a new Size instance

classmethod mebibytes(amount)

Create a Storage representing an amount mebibytes.

1 MiB = 1024 KiB

Parameters

amount (Union[int, float]) – the amount of mebibytes to be represented.

Return type

Size

Returns

a new Size instance

classmethod pebibyte(amount)

(deprecated) Create a Storage representing an amount pebibytes.

1 PiB = 1024 TiB

Parameters

amount (Union[int, float]) –

Deprecated

use pebibytes instead

Stability

deprecated

Return type

Size

classmethod pebibytes(amount)

Create a Storage representing an amount pebibytes.

1 PiB = 1024 TiB

Parameters

amount (Union[int, float]) – the amount of pebibytes to be represented.

Return type

Size

Returns

a new Size instance

classmethod tebibytes(amount)

Create a Storage representing an amount tebibytes.

1 TiB = 1024 GiB

Parameters

amount (Union[int, float]) – the amount of tebibytes to be represented.

Return type

Size

Returns

a new Size instance