Skip to content
v2.278.0

CfnContainerProps Struct ​

Properties for defining a CfnContainer.

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 cfnContainerProps: lightsail.CfnContainerProps = {
  power: 'power',
  scale: 123,
  serviceName: 'serviceName',

  // the properties below are optional
  containerServiceDeployment: {
    containers: [{
      command: ['command'],
      containerName: 'containerName',
      environment: [{
        value: 'value',
        variable: 'variable',
      }],
      image: 'image',
      ports: [{
        port: 'port',
        protocol: 'protocol',
      }],
    }],
    publicEndpoint: {
      containerName: 'containerName',
      containerPort: 123,
      healthCheckConfig: {
        healthyThreshold: 123,
        intervalSeconds: 123,
        path: 'path',
        successCodes: 'successCodes',
        timeoutSeconds: 123,
        unhealthyThreshold: 123,
      },
    },
  },
  isDisabled: false,
  privateRegistryAccess: {
    ecrImagePullerRole: {
      isActive: false,
      principalArn: 'principalArn',
    },
  },
  publicDomainNames: [{
    certificateName: 'certificateName',
    domainNames: ['domainNames'],
  }],
  tags: [{
    key: 'key',
    value: 'value',
  }],
};
python
from aws_cdk import CfnTag
# 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

cfn_container_props = lightsail.CfnContainerProps(
    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,
    private_registry_access=lightsail.CfnContainer.PrivateRegistryAccessProperty(
        ecr_image_puller_role=lightsail.CfnContainer.EcrImagePullerRoleProperty(
            is_active=False,
            principal_arn="principalArn"
        )
    ),
    public_domain_names=[lightsail.CfnContainer.PublicDomainNameProperty(
        certificate_name="certificateName",
        domain_names=["domainNames"]
    )],
    tags=[CfnTag(
        key="key",
        value="value"
    )]
)
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.*;

CfnContainerProps cfnContainerProps = CfnContainerProps.builder()
        .power("power")
        .scale(123)
        .serviceName("serviceName")

        // the properties below are optional
        .containerServiceDeployment(ContainerServiceDeploymentProperty.builder()
                .containers(List.of(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()))
                .publicEndpoint(PublicEndpointProperty.builder()
                        .containerName("containerName")
                        .containerPort(123)
                        .healthCheckConfig(HealthCheckConfigProperty.builder()
                                .healthyThreshold(123)
                                .intervalSeconds(123)
                                .path("path")
                                .successCodes("successCodes")
                                .timeoutSeconds(123)
                                .unhealthyThreshold(123)
                                .build())
                        .build())
                .build())
        .isDisabled(false)
        .privateRegistryAccess(PrivateRegistryAccessProperty.builder()
                .ecrImagePullerRole(EcrImagePullerRoleProperty.builder()
                        .isActive(false)
                        .principalArn("principalArn")
                        .build())
                .build())
        .publicDomainNames(List.of(PublicDomainNameProperty.builder()
                .certificateName("certificateName")
                .domainNames(List.of("domainNames"))
                .build()))
        .tags(List.of(CfnTag.builder()
                .key("key")
                .value("value")
                .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 cfnContainerProps = new CfnContainerProps {
    Power = "power",
    Scale = 123,
    ServiceName = "serviceName",

    // the properties below are optional
    ContainerServiceDeployment = new ContainerServiceDeploymentProperty {
        Containers = new [] { 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"
            } }
        } },
        PublicEndpoint = new PublicEndpointProperty {
            ContainerName = "containerName",
            ContainerPort = 123,
            HealthCheckConfig = new HealthCheckConfigProperty {
                HealthyThreshold = 123,
                IntervalSeconds = 123,
                Path = "path",
                SuccessCodes = "successCodes",
                TimeoutSeconds = 123,
                UnhealthyThreshold = 123
            }
        }
    },
    IsDisabled = false,
    PrivateRegistryAccess = new PrivateRegistryAccessProperty {
        EcrImagePullerRole = new EcrImagePullerRoleProperty {
            IsActive = false,
            PrincipalArn = "principalArn"
        }
    },
    PublicDomainNames = new [] { new PublicDomainNameProperty {
        CertificateName = "certificateName",
        DomainNames = new [] { "domainNames" }
    } },
    Tags = new [] { new CfnTag {
        Key = "key",
        Value = "value"
    } }
};
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"

cfnContainerProps := &CfnContainerProps{
	Power: jsii.String("power"),
	Scale: jsii.Number(123),
	ServiceName: jsii.String("serviceName"),

	// the properties below are optional
	ContainerServiceDeployment: &ContainerServiceDeploymentProperty{
		Containers: []interface{}{
			&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"),
					},
				},
			},
		},
		PublicEndpoint: &PublicEndpointProperty{
			ContainerName: jsii.String("containerName"),
			ContainerPort: jsii.Number(123),
			HealthCheckConfig: &HealthCheckConfigProperty{
				HealthyThreshold: jsii.Number(123),
				IntervalSeconds: jsii.Number(123),
				Path: jsii.String("path"),
				SuccessCodes: jsii.String("successCodes"),
				TimeoutSeconds: jsii.Number(123),
				UnhealthyThreshold: jsii.Number(123),
			},
		},
	},
	IsDisabled: jsii.Boolean(false),
	PrivateRegistryAccess: &PrivateRegistryAccessProperty{
		EcrImagePullerRole: &EcrImagePullerRoleProperty{
			IsActive: jsii.Boolean(false),
			PrincipalArn: jsii.String("principalArn"),
		},
	},
	PublicDomainNames: []interface{}{
		&PublicDomainNameProperty{
			CertificateName: jsii.String("certificateName"),
			DomainNames: []*string{
				jsii.String("domainNames"),
			},
		},
	},
	Tags: []CfnTag{
		&CfnTag{
			Key: jsii.String("key"),
			Value: jsii.String("value"),
		},
	},
}

Properties ​

containerServiceDeploymentoptionalIResolvable | CfnContainer.ContainerServiceDeploymentPropertycontainer_service_deploymentoptionaltyping.Union[IResolvable, ContainerServiceDeploymentProperty]containerServiceDeploymentoptionalIResolvableContainerServiceDeploymentoptionalIResolvableContainerServiceDeploymentoptionalinterface{} #
An object that describes the current container deployment of the container service.
isDisabledoptionalboolean | IResolvableis_disabledoptionaltyping.Union[bool, IResolvable]isDisabledoptionalBooleanIsDisabledoptionalboolIsDisabledoptionalinterface{} #
A Boolean value indicating whether the container service is disabled.
powerstringpowerstrpowerStringPowerstringPower*string required #
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.

privateRegistryAccessoptionalIResolvable | CfnContainer.PrivateRegistryAccessPropertyprivate_registry_accessoptionaltyping.Union[IResolvable, PrivateRegistryAccessProperty]privateRegistryAccessoptionalIResolvablePrivateRegistryAccessoptionalIResolvablePrivateRegistryAccessoptionalinterface{} #
An object that describes the configuration for the container service to access private container image repositories, such as ( Amazon ECR ) private repositories.
notes

For more information, see Configuring access to an Amazon ECR private repository for an Amazon Lightsail container service in the Amazon Lightsail Developer Guide .

publicDomainNamesoptionalIResolvable | IResolvable | CfnContainer.PublicDomainNameProperty[]public_domain_namesoptionaltyping.Union[IResolvable, typing.List[typing.Union[IResolvable, PublicDomainNameProperty]]]publicDomainNamesoptionalIResolvablePublicDomainNamesoptionalIResolvablePublicDomainNamesoptionalinterface{} #
The public domain name of the container service, such as `example.com` and `www.example.com` .
notes

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.

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.

scalenumberscaleint | floatscaleNumberScaledoubleScale*float64 required #
The scale specification of the container service.

The scale specifies the allocated compute nodes of the container service.

serviceNamestringservice_namestrserviceNameStringServiceNamestringServiceName*string required #
The name of the container service.
tagsoptionalCfnTag[]tagsoptionaltyping.List[CfnTag]tagsoptionalList<CfnTag>TagsoptionalCfnTag[]Tagsoptional*[]CfnTag #
An array of key-value pairs to apply to this resource.

For more information, see Tag in the AWS CloudFormation User Guide .

The Value of Tags is optional for Lightsail resources.