Size
- class aws_cdk.Size(*args: Any, **kwargs)
Bases:
objectRepresents 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.
- ExampleMetadata:
infused
Example:
# my_file_system: efs.IFileSystem # my_job_role: iam.Role my_file_system.grant_read(my_job_role) job_defn = batch.EcsJobDefinition(self, "JobDefn", container=batch.EcsEc2ContainerDefinition(self, "containerDefn", image=ecs.ContainerImage.from_registry("public.ecr.aws/amazonlinux/amazonlinux:latest"), memory=cdk.Size.mebibytes(2048), cpu=256, volumes=[batch.EcsVolume.efs( name="myVolume", file_system=my_file_system, container_path="/Volumes/myVolume", use_job_role=True )], job_role=my_job_role ) )
Methods
- is_unresolved()
Checks if size is a token or a resolvable object.
- Return type:
bool
- to_bytes(*, rounding=None)
Return this storage as a total number of bytes.
- 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 expressed in bytes
- 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 bytes(amount)
Create a Storage representing an amount bytes.
- Parameters:
amount (
Union[int,float]) – the amount of bytes to be represented.- Return type:
- Returns:
a new
Sizeinstance
- 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:
- Returns:
a new
Sizeinstance
- 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:
- Returns:
a new
Sizeinstance
- 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:
- Returns:
a new
Sizeinstance
- 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:
- Returns:
a new
Sizeinstance