Skip to content
v2.278.0

ExpressGatewayContainerProperty Struct ​

Defines the configuration for the primary container in an Express service.

This container receives traffic from the Application Load Balancer and runs your application code.

The container configuration includes the container image, port mapping, logging settings, environment variables, and secrets. The container image is the only required parameter, with sensible defaults provided for other settings.

Example ​

ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_ecs as ecs } from 'aws-cdk-lib';
const expressGatewayContainerProperty: ecs.CfnExpressGatewayService.ExpressGatewayContainerProperty = {
  image: 'image',

  // the properties below are optional
  awsLogsConfiguration: {
    logGroup: 'logGroup',
    logStreamPrefix: 'logStreamPrefix',
  },
  command: ['command'],
  containerPort: 123,
  environment: [{
    name: 'name',
    value: 'value',
  }],
  repositoryCredentials: {
    credentialsParameter: 'credentialsParameter',
  },
  secrets: [{
    name: 'name',
    valueFrom: 'valueFrom',
  }],
};
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_ecs as ecs

express_gateway_container_property = ecs.CfnExpressGatewayService.ExpressGatewayContainerProperty(
    image="image",

    # the properties below are optional
    aws_logs_configuration=ecs.CfnExpressGatewayService.ExpressGatewayServiceAwsLogsConfigurationProperty(
        log_group="logGroup",
        log_stream_prefix="logStreamPrefix"
    ),
    command=["command"],
    container_port=123,
    environment=[ecs.CfnExpressGatewayService.KeyValuePairProperty(
        name="name",
        value="value"
    )],
    repository_credentials=ecs.CfnExpressGatewayService.ExpressGatewayRepositoryCredentialsProperty(
        credentials_parameter="credentialsParameter"
    ),
    secrets=[ecs.CfnExpressGatewayService.SecretProperty(
        name="name",
        value_from="valueFrom"
    )]
)
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.ecs.*;

ExpressGatewayContainerProperty expressGatewayContainerProperty = ExpressGatewayContainerProperty.builder()
        .image("image")

        // the properties below are optional
        .awsLogsConfiguration(ExpressGatewayServiceAwsLogsConfigurationProperty.builder()
                .logGroup("logGroup")
                .logStreamPrefix("logStreamPrefix")
                .build())
        .command(List.of("command"))
        .containerPort(123)
        .environment(List.of(KeyValuePairProperty.builder()
                .name("name")
                .value("value")
                .build()))
        .repositoryCredentials(ExpressGatewayRepositoryCredentialsProperty.builder()
                .credentialsParameter("credentialsParameter")
                .build())
        .secrets(List.of(SecretProperty.builder()
                .name("name")
                .valueFrom("valueFrom")
                .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.ECS;

var expressGatewayContainerProperty = new ExpressGatewayContainerProperty {
    Image = "image",

    // the properties below are optional
    AwsLogsConfiguration = new ExpressGatewayServiceAwsLogsConfigurationProperty {
        LogGroup = "logGroup",
        LogStreamPrefix = "logStreamPrefix"
    },
    Command = new [] { "command" },
    ContainerPort = 123,
    Environment = new [] { new KeyValuePairProperty {
        Name = "name",
        Value = "value"
    } },
    RepositoryCredentials = new ExpressGatewayRepositoryCredentialsProperty {
        CredentialsParameter = "credentialsParameter"
    },
    Secrets = new [] { new SecretProperty {
        Name = "name",
        ValueFrom = "valueFrom"
    } }
};
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"

expressGatewayContainerProperty := &ExpressGatewayContainerProperty{
	Image: jsii.String("image"),

	// the properties below are optional
	AwsLogsConfiguration: &ExpressGatewayServiceAwsLogsConfigurationProperty{
		LogGroup: jsii.String("logGroup"),
		LogStreamPrefix: jsii.String("logStreamPrefix"),
	},
	Command: []*string{
		jsii.String("command"),
	},
	ContainerPort: jsii.Number(123),
	Environment: []interface{}{
		&KeyValuePairProperty{
			Name: jsii.String("name"),
			Value: jsii.String("value"),
		},
	},
	RepositoryCredentials: &ExpressGatewayRepositoryCredentialsProperty{
		CredentialsParameter: jsii.String("credentialsParameter"),
	},
	Secrets: []interface{}{
		&SecretProperty{
			Name: jsii.String("name"),
			ValueFrom: jsii.String("valueFrom"),
		},
	},
}

Properties ​

awsLogsConfigurationoptionalIResolvable | CfnExpressGatewayService.ExpressGatewayServiceAwsLogsConfigurationPropertyaws_logs_configurationoptionaltyping.Union[IResolvable, ExpressGatewayServiceAwsLogsConfigurationProperty]awsLogsConfigurationoptionalIResolvableAwsLogsConfigurationoptionalIResolvableAwsLogsConfigurationoptionalinterface{} #
The log configuration for the container.
commandoptionalstring[]commandoptionaltyping.List[str]commandoptionalList<String>Commandoptionalstring[]Commandoptional*[]*string #
The command that is passed to the container.
containerPortoptionalnumbercontainer_portoptionalint | floatcontainerPortoptionalNumberContainerPortoptionaldoubleContainerPortoptional*float64 = 80 #
The port number on the container that receives traffic from the load balancer.

Default is 80.

environmentoptionalIResolvable | IResolvable | CfnExpressGatewayService.KeyValuePairProperty[]environmentoptionaltyping.Union[IResolvable, typing.List[typing.Union[IResolvable, KeyValuePairProperty]]]environmentoptionalIResolvableEnvironmentoptionalIResolvableEnvironmentoptionalinterface{} #
The environment variables to pass to the container.
imagestringimagestrimageStringImagestringImage*string required #
The image used to start a container.
notes

This string is passed directly to the Docker daemon. Images in the Docker Hub registry are available by default. Other repositories are specified with either repository-url/image:tag or repository-url/image@digest .

For Express services, the image typically contains a web application that listens on the specified container port. The image can be stored in Amazon ECR, Docker Hub, or any other container registry accessible to your execution role.

repositoryCredentialsoptionalIResolvable | CfnExpressGatewayService.ExpressGatewayRepositoryCredentialsPropertyrepository_credentialsoptionaltyping.Union[IResolvable, ExpressGatewayRepositoryCredentialsProperty]repositoryCredentialsoptionalIResolvableRepositoryCredentialsoptionalIResolvableRepositoryCredentialsoptionalinterface{} #
The configuration for repository credentials for private registry authentication.
secretsoptionalIResolvable | IResolvable | CfnExpressGatewayService.SecretProperty[]secretsoptionaltyping.Union[IResolvable, typing.List[typing.Union[IResolvable, SecretProperty]]]secretsoptionalIResolvableSecretsoptionalIResolvableSecretsoptionalinterface{} #
The secrets to pass to the container.