Skip to content
v2.278.0

ContainerProperty Struct ​

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.

Example ​

ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_lightsail as lightsail } from 'aws-cdk-lib';
const containerProperty: lightsail.CfnContainer.ContainerProperty = {
  command: ['command'],
  containerName: 'containerName',
  environment: [{
    value: 'value',
    variable: 'variable',
  }],
  image: 'image',
  ports: [{
    port: 'port',
    protocol: 'protocol',
  }],
};
python
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import 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"
    )]
)
java
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.services.lightsail.*;

ContainerProperty containerProperty = ContainerProperty.builder()
        .command(List.of("command"))
        .containerName("containerName")
        .environment(List.of(EnvironmentVariableProperty.builder()
                .value("value")
                .variable("variable")
                .build()))
        .image("image")
        .ports(List.of(PortInfoProperty.builder()
                .port("port")
                .protocol("protocol")
                .build()))
        .build();
csharp
// Install: dotnet add package Amazon.CDK.Lib
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK.AWS.Lightsail;

var containerProperty = new ContainerProperty {
    Command = new [] { "command" },
    ContainerName = "containerName",
    Environment = new [] { new EnvironmentVariableProperty {
        Value = "value",
        Variable = "variable"
    } },
    Image = "image",
    Ports = new [] { new PortInfoProperty {
        Port = "port",
        Protocol = "protocol"
    } }
};
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import "github.com/aws/aws-cdk-go/awscdk"

containerProperty := &ContainerProperty{
	Command: []*string{
		jsii.String("command"),
	},
	ContainerName: jsii.String("containerName"),
	Environment: []interface{}{
		&EnvironmentVariableProperty{
			Value: jsii.String("value"),
			Variable: jsii.String("variable"),
		},
	},
	Image: jsii.String("image"),
	Ports: []interface{}{
		&PortInfoProperty{
			Port: jsii.String("port"),
			Protocol: jsii.String("protocol"),
		},
	},
}

Properties ​

commandoptionalstring[]commandoptionaltyping.List[str]commandoptionalList<String>Commandoptionalstring[]Commandoptional*[]*string #
The launch command for the container.
containerNameoptionalstringcontainer_nameoptionalstrcontainerNameoptionalStringContainerNameoptionalstringContainerNameoptional*string #
The name of the container.
environmentoptionalIResolvable | IResolvable | CfnContainer.EnvironmentVariableProperty[]environmentoptionaltyping.Union[IResolvable, typing.List[typing.Union[IResolvable, EnvironmentVariableProperty]]]environmentoptionalIResolvableEnvironmentoptionalIResolvableEnvironmentoptionalinterface{} #
The environment variables of the container.
imageoptionalstringimageoptionalstrimageoptionalStringImageoptionalstringImageoptional*string #
The name of the image used for the container.
notes

Container images that are sourced from (registered and stored on) your container service start with a colon ( : ). For example, if your container service name is container-service-1 , the container image label is mystaticsite , 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, specify latest 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 or nginx .

portsoptionalIResolvable | IResolvable | CfnContainer.PortInfoProperty[]portsoptionaltyping.Union[IResolvable, typing.List[typing.Union[IResolvable, PortInfoProperty]]]portsoptionalIResolvablePortsoptionalIResolvablePortsoptionalinterface{} #
An object that describes the open firewall ports and protocols of the container.