CfnContainer
- class aws_cdk.aws_lightsail.CfnContainer(scope, id, *, power, scale, service_name, container_service_deployment=None, is_disabled=None, public_domain_names=None, tags=None)
Bases:
CfnResource
A CloudFormation
AWS::Lightsail::Container
.The
AWS::Lightsail::Container
resource specifies a container service.A Lightsail container service is a compute resource to which you can deploy containers.
- CloudformationResource:
AWS::Lightsail::Container
- Link:
http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lightsail-container.html
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. import aws_cdk.aws_lightsail as lightsail cfn_container = lightsail.CfnContainer(self, "MyCfnContainer", power="power", scale=123, service_name="serviceName", # the properties below are optional container_service_deployment=lightsail.CfnContainer.ContainerServiceDeploymentProperty( containers=[lightsail.CfnContainer.ContainerProperty( command=["command"], container_name="containerName", environment=[lightsail.CfnContainer.EnvironmentVariableProperty( value="value", variable="variable" )], image="image", ports=[lightsail.CfnContainer.PortInfoProperty( port="port", protocol="protocol" )] )], public_endpoint=lightsail.CfnContainer.PublicEndpointProperty( container_name="containerName", container_port=123, health_check_config=lightsail.CfnContainer.HealthCheckConfigProperty( healthy_threshold=123, interval_seconds=123, path="path", success_codes="successCodes", timeout_seconds=123, unhealthy_threshold=123 ) ) ), is_disabled=False, public_domain_names=[lightsail.CfnContainer.PublicDomainNameProperty( certificate_name="certificateName", domain_names=["domainNames"] )], tags=[CfnTag( key="key", value="value" )] )
Create a new
AWS::Lightsail::Container
.- Parameters:
scope (
Construct
) –scope in which this resource is defined.
id (
str
) –scoped id of the resource.
power (
str
) – The power specification of the container service. The power specifies the amount of RAM, the number of vCPUs, and the base price of the container service.scale (
Union
[int
,float
]) – The scale specification of the container service. The scale specifies the allocated compute nodes of the container service.service_name (
str
) – The name of the container service.container_service_deployment (
Union
[IResolvable
,ContainerServiceDeploymentProperty
,Dict
[str
,Any
],None
]) – An object that describes the current container deployment of the container service.is_disabled (
Union
[bool
,IResolvable
,None
]) – A Boolean value indicating whether the container service is disabled.public_domain_names (
Union
[IResolvable
,Sequence
[Union
[IResolvable
,PublicDomainNameProperty
,Dict
[str
,Any
]]],None
]) – The public domain name of the container service, such asexample.com
andwww.example.com
. You can specify up to four public domain names for a container service. The domain names that you specify are used when you create a deployment with a container that is configured as the public endpoint of your container service. If you don’t specify public domain names, then you can use the default domain of the container service. .. epigraph:: You must create and validate an SSL/TLS certificate before you can use public domain names with your container service. Use the AWS::Lightsail::Certificate resource to create a certificate for the public domain names that you want to use with your container service.tags (
Optional
[Sequence
[Union
[CfnTag
,Dict
[str
,Any
]]]]) – An array of key-value pairs to apply to this resource. For more information, see Tag in the AWS CloudFormation User Guide . .. epigraph:: TheValue
ofTags
is optional for Lightsail resources.
Methods
- add_deletion_override(path)
Syntactic sugar for
addOverride(path, undefined)
.- Parameters:
path (
str
) – The path of the value to delete.- Return type:
None
- add_depends_on(target)
Indicates that this resource depends on another resource and cannot be provisioned unless the other resource has been successfully provisioned.
This can be used for resources across stacks (or nested stack) boundaries and the dependency will automatically be transferred to the relevant scope.
- Parameters:
target (
CfnResource
)- Return type:
None
- add_metadata(key, value)
Add a value to the CloudFormation Resource Metadata.
- Parameters:
key (
str
)value (
Any
)
- See:
- Return type:
None
Note that this is a different set of metadata from CDK node metadata; this metadata ends up in the stack template under the resource, whereas CDK node metadata ends up in the Cloud Assembly.
- add_override(path, value)
Adds an override to the synthesized CloudFormation resource.
To add a property override, either use
addPropertyOverride
or prefixpath
with “Properties.” (i.e.Properties.TopicName
).If the override is nested, separate each nested level using a dot (.) in the path parameter. If there is an array as part of the nesting, specify the index in the path.
To include a literal
.
in the property name, prefix with a\
. In most programming languages you will need to write this as"\\."
because the\
itself will need to be escaped.For example:
cfn_resource.add_override("Properties.GlobalSecondaryIndexes.0.Projection.NonKeyAttributes", ["myattribute"]) cfn_resource.add_override("Properties.GlobalSecondaryIndexes.1.ProjectionType", "INCLUDE")
would add the overrides Example:
"Properties": { "GlobalSecondaryIndexes": [ { "Projection": { "NonKeyAttributes": [ "myattribute" ] ... } ... }, { "ProjectionType": "INCLUDE" ... }, ] ... }
The
value
argument toaddOverride
will not be processed or translated in any way. Pass raw JSON values in here with the correct capitalization for CloudFormation. If you pass CDK classes or structs, they will be rendered with lowercased key names, and CloudFormation will reject the template.- Parameters:
path (
str
) –The path of the property, you can use dot notation to override values in complex types. Any intermdediate keys will be created as needed.
value (
Any
) –The value. Could be primitive or complex.
- Return type:
None
- add_property_deletion_override(property_path)
Adds an override that deletes the value of a property from the resource definition.
- Parameters:
property_path (
str
) – The path to the property.- Return type:
None
- add_property_override(property_path, value)
Adds an override to a resource property.
Syntactic sugar for
addOverride("Properties.<...>", value)
.- Parameters:
property_path (
str
) – The path of the property.value (
Any
) – The value.
- Return type:
None
- apply_removal_policy(policy=None, *, apply_to_update_replace_policy=None, default=None)
Sets the deletion policy of the resource based on the removal policy specified.
The Removal Policy controls what happens to this resource when it stops being managed by CloudFormation, either because you’ve removed it from the CDK application or because you’ve made a change that requires the resource to be replaced.
The resource can be deleted (
RemovalPolicy.DESTROY
), or left in your AWS account for data recovery and cleanup later (RemovalPolicy.RETAIN
).- Parameters:
policy (
Optional
[RemovalPolicy
])apply_to_update_replace_policy (
Optional
[bool
]) – Apply the same deletion policy to the resource’s “UpdateReplacePolicy”. Default: truedefault (
Optional
[RemovalPolicy
]) – The default policy to apply in case the removal policy is not defined. Default: - Default value is resource specific. To determine the default value for a resoure, please consult that specific resource’s documentation.
- Return type:
None
- get_att(attribute_name)
Returns a token for an runtime attribute of this resource.
Ideally, use generated attribute accessors (e.g.
resource.arn
), but this can be used for future compatibility in case there is no generated attribute.- Parameters:
attribute_name (
str
) – The name of the attribute.- Return type:
- get_metadata(key)
Retrieve a value value from the CloudFormation Resource Metadata.
- Parameters:
key (
str
)- See:
- Return type:
Any
Note that this is a different set of metadata from CDK node metadata; this metadata ends up in the stack template under the resource, whereas CDK node metadata ends up in the Cloud Assembly.
- inspect(inspector)
Examines the CloudFormation resource and discloses attributes.
- Parameters:
inspector (
TreeInspector
) –tree inspector to collect and process attributes.
- Return type:
None
- override_logical_id(new_logical_id)
Overrides the auto-generated logical ID with a specific ID.
- Parameters:
new_logical_id (
str
) – The new logical ID to use for this stack element.- Return type:
None
- to_string()
Returns a string representation of this construct.
- Return type:
str
- Returns:
a string representation of this resource
Attributes
- CFN_RESOURCE_TYPE_NAME = 'AWS::Lightsail::Container'
- attr_container_arn
The Amazon Resource Name (ARN) of the container.
- CloudformationAttribute:
ContainerArn
- attr_url
The publicly accessible URL of the container service.
If no public endpoint is specified in the current deployment, this URL returns a 404 response.
- CloudformationAttribute:
Url
- cfn_options
Options for this resource, such as condition, update policy etc.
- cfn_resource_type
AWS resource type.
- container_service_deployment
An object that describes the current container deployment of the container service.
- creation_stack
return:
the stack trace of the point where this Resource was created from, sourced from the +metadata+ entry typed +aws:cdk:logicalId+, and with the bottom-most node +internal+ entries filtered.
- is_disabled
A Boolean value indicating whether the container service is disabled.
- logical_id
The logical ID for this CloudFormation stack element.
The logical ID of the element is calculated from the path of the resource node in the construct tree.
To override this value, use
overrideLogicalId(newLogicalId)
.- Returns:
the logical ID as a stringified token. This value will only get resolved during synthesis.
- node
The construct tree node associated with this construct.
- power
The power specification of the container service.
The power specifies the amount of RAM, the number of vCPUs, and the base price of the container service.
- public_domain_names
The public domain name of the container service, such as
example.com
andwww.example.com
.You can specify up to four public domain names for a container service. The domain names that you specify are used when you create a deployment with a container that is configured as the public endpoint of your container service.
If you don’t specify public domain names, then you can use the default domain of the container service. .. epigraph:
You must create and validate an SSL/TLS certificate before you can use public domain names with your container service. Use the `AWS::Lightsail::Certificate <https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lightsail-certificate.html>`_ resource to create a certificate for the public domain names that you want to use with your container service.
- ref
Return a string that will be resolved to a CloudFormation
{ Ref }
for this element.If, by any chance, the intrinsic reference of a resource is not a string, you could coerce it to an IResolvable through
Lazy.any({ produce: resource.ref })
.
- scale
The scale specification of the container service.
The scale specifies the allocated compute nodes of the container service.
- service_name
The name of the container service.
- stack
The stack in which this element is defined.
CfnElements must be defined within a stack scope (directly or indirectly).
- tags
An array of key-value pairs to apply to this resource.
For more information, see Tag in the AWS CloudFormation User Guide . .. epigraph:
The ``Value`` of ``Tags`` is optional for Lightsail resources.
Static Methods
- classmethod is_cfn_element(x)
Returns
true
if a construct is a stack element (i.e. part of the synthesized cloudformation template).Uses duck-typing instead of
instanceof
to allow stack elements from different versions of this library to be included in the same stack.- Parameters:
x (
Any
)- Return type:
bool
- Returns:
The construct as a stack element or undefined if it is not a stack element.
- classmethod is_cfn_resource(construct)
Check whether the given construct is a CfnResource.
- Parameters:
construct (
IConstruct
)- Return type:
bool
- classmethod is_construct(x)
Return whether the given object is a Construct.
- Parameters:
x (
Any
)- Return type:
bool
ContainerProperty
- class CfnContainer.ContainerProperty(*, command=None, container_name=None, environment=None, image=None, ports=None)
Bases:
object
Container
is a property of the ContainerServiceDeployment property. It describes the settings of a container that will be launched, or that is launched, to an Amazon Lightsail container service.- Parameters:
command (
Optional
[Sequence
[str
]]) – The launch command for the container.container_name (
Optional
[str
]) – The name of the container.environment (
Union
[IResolvable
,Sequence
[Union
[IResolvable
,EnvironmentVariableProperty
,Dict
[str
,Any
]]],None
]) – The environment variables of the container.image (
Optional
[str
]) – The name of the image used for the container. Container images that are sourced from (registered and stored on) your container service start with a colon (:
). For example, if your container service name iscontainer-service-1
, the container image label ismystaticsite
, and you want to use the third version (3
) of the registered container image, then you should specify:container-service-1.mystaticsite.3
. To use the latest version of a container image, specifylatest
instead of a version number (for example,:container-service-1.mystaticsite.latest
). Your container service will automatically use the highest numbered version of the registered container image. Container images that are sourced from a public registry like Docker Hub don’t start with a colon. For example,nginx:latest
ornginx
.ports (
Union
[IResolvable
,Sequence
[Union
[IResolvable
,PortInfoProperty
,Dict
[str
,Any
]]],None
]) – An object that describes the open firewall ports and protocols of the container.
- Link:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. import aws_cdk.aws_lightsail as lightsail container_property = lightsail.CfnContainer.ContainerProperty( command=["command"], container_name="containerName", environment=[lightsail.CfnContainer.EnvironmentVariableProperty( value="value", variable="variable" )], image="image", ports=[lightsail.CfnContainer.PortInfoProperty( port="port", protocol="protocol" )] )
Attributes
- command
The launch command for the container.
- container_name
The name of the container.
- environment
The environment variables of the container.
- image
The name of the image used for the container.
Container images that are sourced from (registered and stored on) your container service start with a colon (
:
). For example, if your container service name iscontainer-service-1
, the container image label ismystaticsite
, and you want to use the third version (3
) of the registered container image, then you should specify:container-service-1.mystaticsite.3
. To use the latest version of a container image, specifylatest
instead of a version number (for example,:container-service-1.mystaticsite.latest
). Your container service will automatically use the highest numbered version of the registered container image.Container images that are sourced from a public registry like Docker Hub don’t start with a colon. For example,
nginx:latest
ornginx
.
- ports
An object that describes the open firewall ports and protocols of the container.
ContainerServiceDeploymentProperty
- class CfnContainer.ContainerServiceDeploymentProperty(*, containers=None, public_endpoint=None)
Bases:
object
ContainerServiceDeployment
is a property of the AWS::Lightsail::Container resource. It describes a container deployment configuration of a container service.A deployment specifies the settings, such as the ports and launch command, of containers that are deployed to your container service.
- Parameters:
containers (
Union
[IResolvable
,Sequence
[Union
[IResolvable
,ContainerProperty
,Dict
[str
,Any
]]],None
]) – An object that describes the configuration for the containers of the deployment.public_endpoint (
Union
[IResolvable
,PublicEndpointProperty
,Dict
[str
,Any
],None
]) – An object that describes the endpoint of the deployment.
- Link:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. import aws_cdk.aws_lightsail as lightsail container_service_deployment_property = lightsail.CfnContainer.ContainerServiceDeploymentProperty( containers=[lightsail.CfnContainer.ContainerProperty( command=["command"], container_name="containerName", environment=[lightsail.CfnContainer.EnvironmentVariableProperty( value="value", variable="variable" )], image="image", ports=[lightsail.CfnContainer.PortInfoProperty( port="port", protocol="protocol" )] )], public_endpoint=lightsail.CfnContainer.PublicEndpointProperty( container_name="containerName", container_port=123, health_check_config=lightsail.CfnContainer.HealthCheckConfigProperty( healthy_threshold=123, interval_seconds=123, path="path", success_codes="successCodes", timeout_seconds=123, unhealthy_threshold=123 ) ) )
Attributes
- containers
An object that describes the configuration for the containers of the deployment.
- public_endpoint
An object that describes the endpoint of the deployment.
EnvironmentVariableProperty
- class CfnContainer.EnvironmentVariableProperty(*, value=None, variable=None)
Bases:
object
EnvironmentVariable
is a property of the Container property. It describes the environment variables of a container on a container service which are key-value parameters that provide dynamic configuration of the application or script run by the container.- Parameters:
value (
Optional
[str
]) – The environment variable value.variable (
Optional
[str
]) – The environment variable key.
- Link:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. import aws_cdk.aws_lightsail as lightsail environment_variable_property = lightsail.CfnContainer.EnvironmentVariableProperty( value="value", variable="variable" )
Attributes
- value
The environment variable value.
- variable
The environment variable key.
HealthCheckConfigProperty
- class CfnContainer.HealthCheckConfigProperty(*, healthy_threshold=None, interval_seconds=None, path=None, success_codes=None, timeout_seconds=None, unhealthy_threshold=None)
Bases:
object
HealthCheckConfig
is a property of the PublicEndpoint property. It describes the healthcheck configuration of a container deployment on a container service.- Parameters:
healthy_threshold (
Union
[int
,float
,None
]) – The number of consecutive health check successes required before moving the container to theHealthy
state. The default value is2
.interval_seconds (
Union
[int
,float
,None
]) – The approximate interval, in seconds, between health checks of an individual container. You can specify between5
and300
seconds. The default value is5
.path (
Optional
[str
]) – The path on the container on which to perform the health check. The default value is/
.success_codes (
Optional
[str
]) – The HTTP codes to use when checking for a successful response from a container. You can specify values between200
and499
. You can specify multiple values (for example,200,202
) or a range of values (for example,200-299
).timeout_seconds (
Union
[int
,float
,None
]) – The amount of time, in seconds, during which no response means a failed health check. You can specify between2
and60
seconds. The default value is2
.unhealthy_threshold (
Union
[int
,float
,None
]) – The number of consecutive health check failures required before moving the container to theUnhealthy
state. The default value is2
.
- Link:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. import aws_cdk.aws_lightsail as lightsail health_check_config_property = lightsail.CfnContainer.HealthCheckConfigProperty( healthy_threshold=123, interval_seconds=123, path="path", success_codes="successCodes", timeout_seconds=123, unhealthy_threshold=123 )
Attributes
- healthy_threshold
The number of consecutive health check successes required before moving the container to the
Healthy
state.The default value is
2
.
- interval_seconds
The approximate interval, in seconds, between health checks of an individual container.
You can specify between
5
and300
seconds. The default value is5
.
- path
The path on the container on which to perform the health check.
The default value is
/
.
- success_codes
The HTTP codes to use when checking for a successful response from a container.
You can specify values between
200
and499
. You can specify multiple values (for example,200,202
) or a range of values (for example,200-299
).
- timeout_seconds
The amount of time, in seconds, during which no response means a failed health check.
You can specify between
2
and60
seconds. The default value is2
.
- unhealthy_threshold
The number of consecutive health check failures required before moving the container to the
Unhealthy
state.The default value is
2
.
PortInfoProperty
- class CfnContainer.PortInfoProperty(*, port=None, protocol=None)
Bases:
object
PortInfo
is a property of the Container property. It describes the ports to open and the protocols to use for a container on a Amazon Lightsail container service.- Parameters:
port (
Optional
[str
]) – The open firewall ports of the container.protocol (
Optional
[str
]) – The protocol name for the open ports. Allowed values :HTTP
|HTTPS
|TCP
|UDP
- Link:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. import aws_cdk.aws_lightsail as lightsail port_info_property = lightsail.CfnContainer.PortInfoProperty( port="port", protocol="protocol" )
Attributes
- port
The open firewall ports of the container.
- protocol
The protocol name for the open ports.
Allowed values :
HTTP
|HTTPS
|TCP
|UDP
PublicDomainNameProperty
- class CfnContainer.PublicDomainNameProperty(*, certificate_name=None, domain_names=None)
Bases:
object
PublicDomainName
is a property of the AWS::Lightsail::Container resource. It describes the public domain names to use with a container service, such asexample.com
andwww.example.com
. It also describes the certificates to use with a container service.- Parameters:
certificate_name (
Optional
[str
]) – The name of the certificate for the public domains.domain_names (
Optional
[Sequence
[str
]]) – The public domain names to use with the container service.
- Link:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. import aws_cdk.aws_lightsail as lightsail public_domain_name_property = lightsail.CfnContainer.PublicDomainNameProperty( certificate_name="certificateName", domain_names=["domainNames"] )
Attributes
- certificate_name
The name of the certificate for the public domains.
- domain_names
The public domain names to use with the container service.
PublicEndpointProperty
- class CfnContainer.PublicEndpointProperty(*, container_name=None, container_port=None, health_check_config=None)
Bases:
object
PublicEndpoint
is a property of the ContainerServiceDeployment property. It describes describes the settings of the public endpoint of a container on a container service.- Parameters:
container_name (
Optional
[str
]) – The name of the container entry of the deployment that the endpoint configuration applies to.container_port (
Union
[int
,float
,None
]) – The port of the specified container to which traffic is forwarded to.health_check_config (
Union
[IResolvable
,HealthCheckConfigProperty
,Dict
[str
,Any
],None
]) – An object that describes the health check configuration of the container.
- Link:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. import aws_cdk.aws_lightsail as lightsail public_endpoint_property = lightsail.CfnContainer.PublicEndpointProperty( container_name="containerName", container_port=123, health_check_config=lightsail.CfnContainer.HealthCheckConfigProperty( healthy_threshold=123, interval_seconds=123, path="path", success_codes="successCodes", timeout_seconds=123, unhealthy_threshold=123 ) )
Attributes
- container_name
The name of the container entry of the deployment that the endpoint configuration applies to.
- container_port
The port of the specified container to which traffic is forwarded to.
- health_check_config
An object that describes the health check configuration of the container.