Skip to content
v2.278.0

CfnServiceProps Struct ​

Properties for defining a CfnService.

Example ​

ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_apprunner as apprunner } from 'aws-cdk-lib';
const cfnServiceProps: apprunner.CfnServiceProps = {
  sourceConfiguration: {
    authenticationConfiguration: {
      accessRoleArn: 'accessRoleArn',
      connectionArn: 'connectionArn',
    },
    autoDeploymentsEnabled: false,
    codeRepository: {
      repositoryUrl: 'repositoryUrl',
      sourceCodeVersion: {
        type: 'type',
        value: 'value',
      },

      // the properties below are optional
      codeConfiguration: {
        configurationSource: 'configurationSource',

        // the properties below are optional
        codeConfigurationValues: {
          runtime: 'runtime',

          // the properties below are optional
          buildCommand: 'buildCommand',
          port: 'port',
          runtimeEnvironmentSecrets: [{
            name: 'name',
            value: 'value',
          }],
          runtimeEnvironmentVariables: [{
            name: 'name',
            value: 'value',
          }],
          startCommand: 'startCommand',
        },
      },
      sourceDirectory: 'sourceDirectory',
    },
    imageRepository: {
      imageIdentifier: 'imageIdentifier',
      imageRepositoryType: 'imageRepositoryType',

      // the properties below are optional
      imageConfiguration: {
        port: 'port',
        runtimeEnvironmentSecrets: [{
          name: 'name',
          value: 'value',
        }],
        runtimeEnvironmentVariables: [{
          name: 'name',
          value: 'value',
        }],
        startCommand: 'startCommand',
      },
    },
  },

  // the properties below are optional
  autoScalingConfigurationArn: 'autoScalingConfigurationArn',
  encryptionConfiguration: {
    kmsKey: 'kmsKey',
  },
  healthCheckConfiguration: {
    healthyThreshold: 123,
    interval: 123,
    path: 'path',
    protocol: 'protocol',
    timeout: 123,
    unhealthyThreshold: 123,
  },
  instanceConfiguration: {
    cpu: 'cpu',
    instanceRoleArn: 'instanceRoleArn',
    memory: 'memory',
  },
  networkConfiguration: {
    egressConfiguration: {
      egressType: 'egressType',

      // the properties below are optional
      vpcConnectorArn: 'vpcConnectorArn',
    },
    ingressConfiguration: {
      isPubliclyAccessible: false,
    },
    ipAddressType: 'ipAddressType',
  },
  observabilityConfiguration: {
    observabilityEnabled: false,

    // the properties below are optional
    observabilityConfigurationArn: 'observabilityConfigurationArn',
  },
  serviceName: 'serviceName',
  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_apprunner as apprunner

cfn_service_props = apprunner.CfnServiceProps(
    source_configuration=apprunner.CfnService.SourceConfigurationProperty(
        authentication_configuration=apprunner.CfnService.AuthenticationConfigurationProperty(
            access_role_arn="accessRoleArn",
            connection_arn="connectionArn"
        ),
        auto_deployments_enabled=False,
        code_repository=apprunner.CfnService.CodeRepositoryProperty(
            repository_url="repositoryUrl",
            source_code_version=apprunner.CfnService.SourceCodeVersionProperty(
                type="type",
                value="value"
            ),

            # the properties below are optional
            code_configuration=apprunner.CfnService.CodeConfigurationProperty(
                configuration_source="configurationSource",

                # the properties below are optional
                code_configuration_values=apprunner.CfnService.CodeConfigurationValuesProperty(
                    runtime="runtime",

                    # the properties below are optional
                    build_command="buildCommand",
                    port="port",
                    runtime_environment_secrets=[apprunner.CfnService.KeyValuePairProperty(
                        name="name",
                        value="value"
                    )],
                    runtime_environment_variables=[apprunner.CfnService.KeyValuePairProperty(
                        name="name",
                        value="value"
                    )],
                    start_command="startCommand"
                )
            ),
            source_directory="sourceDirectory"
        ),
        image_repository=apprunner.CfnService.ImageRepositoryProperty(
            image_identifier="imageIdentifier",
            image_repository_type="imageRepositoryType",

            # the properties below are optional
            image_configuration=apprunner.CfnService.ImageConfigurationProperty(
                port="port",
                runtime_environment_secrets=[apprunner.CfnService.KeyValuePairProperty(
                    name="name",
                    value="value"
                )],
                runtime_environment_variables=[apprunner.CfnService.KeyValuePairProperty(
                    name="name",
                    value="value"
                )],
                start_command="startCommand"
            )
        )
    ),

    # the properties below are optional
    auto_scaling_configuration_arn="autoScalingConfigurationArn",
    encryption_configuration=apprunner.CfnService.EncryptionConfigurationProperty(
        kms_key="kmsKey"
    ),
    health_check_configuration=apprunner.CfnService.HealthCheckConfigurationProperty(
        healthy_threshold=123,
        interval=123,
        path="path",
        protocol="protocol",
        timeout=123,
        unhealthy_threshold=123
    ),
    instance_configuration=apprunner.CfnService.InstanceConfigurationProperty(
        cpu="cpu",
        instance_role_arn="instanceRoleArn",
        memory="memory"
    ),
    network_configuration=apprunner.CfnService.NetworkConfigurationProperty(
        egress_configuration=apprunner.CfnService.EgressConfigurationProperty(
            egress_type="egressType",

            # the properties below are optional
            vpc_connector_arn="vpcConnectorArn"
        ),
        ingress_configuration=apprunner.CfnService.IngressConfigurationProperty(
            is_publicly_accessible=False
        ),
        ip_address_type="ipAddressType"
    ),
    observability_configuration=apprunner.CfnService.ServiceObservabilityConfigurationProperty(
        observability_enabled=False,

        # the properties below are optional
        observability_configuration_arn="observabilityConfigurationArn"
    ),
    service_name="serviceName",
    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.apprunner.*;

CfnServiceProps cfnServiceProps = CfnServiceProps.builder()
        .sourceConfiguration(SourceConfigurationProperty.builder()
                .authenticationConfiguration(AuthenticationConfigurationProperty.builder()
                        .accessRoleArn("accessRoleArn")
                        .connectionArn("connectionArn")
                        .build())
                .autoDeploymentsEnabled(false)
                .codeRepository(CodeRepositoryProperty.builder()
                        .repositoryUrl("repositoryUrl")
                        .sourceCodeVersion(SourceCodeVersionProperty.builder()
                                .type("type")
                                .value("value")
                                .build())

                        // the properties below are optional
                        .codeConfiguration(CodeConfigurationProperty.builder()
                                .configurationSource("configurationSource")

                                // the properties below are optional
                                .codeConfigurationValues(CodeConfigurationValuesProperty.builder()
                                        .runtime("runtime")

                                        // the properties below are optional
                                        .buildCommand("buildCommand")
                                        .port("port")
                                        .runtimeEnvironmentSecrets(List.of(KeyValuePairProperty.builder()
                                                .name("name")
                                                .value("value")
                                                .build()))
                                        .runtimeEnvironmentVariables(List.of(KeyValuePairProperty.builder()
                                                .name("name")
                                                .value("value")
                                                .build()))
                                        .startCommand("startCommand")
                                        .build())
                                .build())
                        .sourceDirectory("sourceDirectory")
                        .build())
                .imageRepository(ImageRepositoryProperty.builder()
                        .imageIdentifier("imageIdentifier")
                        .imageRepositoryType("imageRepositoryType")

                        // the properties below are optional
                        .imageConfiguration(ImageConfigurationProperty.builder()
                                .port("port")
                                .runtimeEnvironmentSecrets(List.of(KeyValuePairProperty.builder()
                                        .name("name")
                                        .value("value")
                                        .build()))
                                .runtimeEnvironmentVariables(List.of(KeyValuePairProperty.builder()
                                        .name("name")
                                        .value("value")
                                        .build()))
                                .startCommand("startCommand")
                                .build())
                        .build())
                .build())

        // the properties below are optional
        .autoScalingConfigurationArn("autoScalingConfigurationArn")
        .encryptionConfiguration(EncryptionConfigurationProperty.builder()
                .kmsKey("kmsKey")
                .build())
        .healthCheckConfiguration(HealthCheckConfigurationProperty.builder()
                .healthyThreshold(123)
                .interval(123)
                .path("path")
                .protocol("protocol")
                .timeout(123)
                .unhealthyThreshold(123)
                .build())
        .instanceConfiguration(InstanceConfigurationProperty.builder()
                .cpu("cpu")
                .instanceRoleArn("instanceRoleArn")
                .memory("memory")
                .build())
        .networkConfiguration(NetworkConfigurationProperty.builder()
                .egressConfiguration(EgressConfigurationProperty.builder()
                        .egressType("egressType")

                        // the properties below are optional
                        .vpcConnectorArn("vpcConnectorArn")
                        .build())
                .ingressConfiguration(IngressConfigurationProperty.builder()
                        .isPubliclyAccessible(false)
                        .build())
                .ipAddressType("ipAddressType")
                .build())
        .observabilityConfiguration(ServiceObservabilityConfigurationProperty.builder()
                .observabilityEnabled(false)

                // the properties below are optional
                .observabilityConfigurationArn("observabilityConfigurationArn")
                .build())
        .serviceName("serviceName")
        .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.AppRunner;

var cfnServiceProps = new CfnServiceProps {
    SourceConfiguration = new SourceConfigurationProperty {
        AuthenticationConfiguration = new AuthenticationConfigurationProperty {
            AccessRoleArn = "accessRoleArn",
            ConnectionArn = "connectionArn"
        },
        AutoDeploymentsEnabled = false,
        CodeRepository = new CodeRepositoryProperty {
            RepositoryUrl = "repositoryUrl",
            SourceCodeVersion = new SourceCodeVersionProperty {
                Type = "type",
                Value = "value"
            },

            // the properties below are optional
            CodeConfiguration = new CodeConfigurationProperty {
                ConfigurationSource = "configurationSource",

                // the properties below are optional
                CodeConfigurationValues = new CodeConfigurationValuesProperty {
                    Runtime = "runtime",

                    // the properties below are optional
                    BuildCommand = "buildCommand",
                    Port = "port",
                    RuntimeEnvironmentSecrets = new [] { new KeyValuePairProperty {
                        Name = "name",
                        Value = "value"
                    } },
                    RuntimeEnvironmentVariables = new [] { new KeyValuePairProperty {
                        Name = "name",
                        Value = "value"
                    } },
                    StartCommand = "startCommand"
                }
            },
            SourceDirectory = "sourceDirectory"
        },
        ImageRepository = new ImageRepositoryProperty {
            ImageIdentifier = "imageIdentifier",
            ImageRepositoryType = "imageRepositoryType",

            // the properties below are optional
            ImageConfiguration = new ImageConfigurationProperty {
                Port = "port",
                RuntimeEnvironmentSecrets = new [] { new KeyValuePairProperty {
                    Name = "name",
                    Value = "value"
                } },
                RuntimeEnvironmentVariables = new [] { new KeyValuePairProperty {
                    Name = "name",
                    Value = "value"
                } },
                StartCommand = "startCommand"
            }
        }
    },

    // the properties below are optional
    AutoScalingConfigurationArn = "autoScalingConfigurationArn",
    EncryptionConfiguration = new EncryptionConfigurationProperty {
        KmsKey = "kmsKey"
    },
    HealthCheckConfiguration = new HealthCheckConfigurationProperty {
        HealthyThreshold = 123,
        Interval = 123,
        Path = "path",
        Protocol = "protocol",
        Timeout = 123,
        UnhealthyThreshold = 123
    },
    InstanceConfiguration = new InstanceConfigurationProperty {
        Cpu = "cpu",
        InstanceRoleArn = "instanceRoleArn",
        Memory = "memory"
    },
    NetworkConfiguration = new NetworkConfigurationProperty {
        EgressConfiguration = new EgressConfigurationProperty {
            EgressType = "egressType",

            // the properties below are optional
            VpcConnectorArn = "vpcConnectorArn"
        },
        IngressConfiguration = new IngressConfigurationProperty {
            IsPubliclyAccessible = false
        },
        IpAddressType = "ipAddressType"
    },
    ObservabilityConfiguration = new ServiceObservabilityConfigurationProperty {
        ObservabilityEnabled = false,

        // the properties below are optional
        ObservabilityConfigurationArn = "observabilityConfigurationArn"
    },
    ServiceName = "serviceName",
    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"

cfnServiceProps := &CfnServiceProps{
	SourceConfiguration: &SourceConfigurationProperty{
		AuthenticationConfiguration: &AuthenticationConfigurationProperty{
			AccessRoleArn: jsii.String("accessRoleArn"),
			ConnectionArn: jsii.String("connectionArn"),
		},
		AutoDeploymentsEnabled: jsii.Boolean(false),
		CodeRepository: &CodeRepositoryProperty{
			RepositoryUrl: jsii.String("repositoryUrl"),
			SourceCodeVersion: &SourceCodeVersionProperty{
				Type: jsii.String("type"),
				Value: jsii.String("value"),
			},

			// the properties below are optional
			CodeConfiguration: &CodeConfigurationProperty{
				ConfigurationSource: jsii.String("configurationSource"),

				// the properties below are optional
				CodeConfigurationValues: &CodeConfigurationValuesProperty{
					Runtime: jsii.String("runtime"),

					// the properties below are optional
					BuildCommand: jsii.String("buildCommand"),
					Port: jsii.String("port"),
					RuntimeEnvironmentSecrets: []interface{}{
						&KeyValuePairProperty{
							Name: jsii.String("name"),
							Value: jsii.String("value"),
						},
					},
					RuntimeEnvironmentVariables: []interface{}{
						&KeyValuePairProperty{
							Name: jsii.String("name"),
							Value: jsii.String("value"),
						},
					},
					StartCommand: jsii.String("startCommand"),
				},
			},
			SourceDirectory: jsii.String("sourceDirectory"),
		},
		ImageRepository: &ImageRepositoryProperty{
			ImageIdentifier: jsii.String("imageIdentifier"),
			ImageRepositoryType: jsii.String("imageRepositoryType"),

			// the properties below are optional
			ImageConfiguration: &ImageConfigurationProperty{
				Port: jsii.String("port"),
				RuntimeEnvironmentSecrets: []interface{}{
					&KeyValuePairProperty{
						Name: jsii.String("name"),
						Value: jsii.String("value"),
					},
				},
				RuntimeEnvironmentVariables: []interface{}{
					&KeyValuePairProperty{
						Name: jsii.String("name"),
						Value: jsii.String("value"),
					},
				},
				StartCommand: jsii.String("startCommand"),
			},
		},
	},

	// the properties below are optional
	AutoScalingConfigurationArn: jsii.String("autoScalingConfigurationArn"),
	EncryptionConfiguration: &EncryptionConfigurationProperty{
		KmsKey: jsii.String("kmsKey"),
	},
	HealthCheckConfiguration: &HealthCheckConfigurationProperty{
		HealthyThreshold: jsii.Number(123),
		Interval: jsii.Number(123),
		Path: jsii.String("path"),
		Protocol: jsii.String("protocol"),
		Timeout: jsii.Number(123),
		UnhealthyThreshold: jsii.Number(123),
	},
	InstanceConfiguration: &InstanceConfigurationProperty{
		Cpu: jsii.String("cpu"),
		InstanceRoleArn: jsii.String("instanceRoleArn"),
		Memory: jsii.String("memory"),
	},
	NetworkConfiguration: &NetworkConfigurationProperty{
		EgressConfiguration: &EgressConfigurationProperty{
			EgressType: jsii.String("egressType"),

			// the properties below are optional
			VpcConnectorArn: jsii.String("vpcConnectorArn"),
		},
		IngressConfiguration: &IngressConfigurationProperty{
			IsPubliclyAccessible: jsii.Boolean(false),
		},
		IpAddressType: jsii.String("ipAddressType"),
	},
	ObservabilityConfiguration: &ServiceObservabilityConfigurationProperty{
		ObservabilityEnabled: jsii.Boolean(false),

		// the properties below are optional
		ObservabilityConfigurationArn: jsii.String("observabilityConfigurationArn"),
	},
	ServiceName: jsii.String("serviceName"),
	Tags: []CfnTag{
		&CfnTag{
			Key: jsii.String("key"),
			Value: jsii.String("value"),
		},
	},
}

Properties ​

autoScalingConfigurationArnoptionalstringauto_scaling_configuration_arnoptionalstrautoScalingConfigurationArnoptionalStringAutoScalingConfigurationArnoptionalstringAutoScalingConfigurationArnoptional*string #
The Amazon Resource Name (ARN) of an App Runner automatic scaling configuration resource that you want to associate with your service.
notes

If not provided, App Runner associates the latest revision of a default auto scaling configuration.

Specify an ARN with a name and a revision number to associate that revision. For example: arn:aws:apprunner:us-east-1:123456789012:autoscalingconfiguration/high-availability/3

Specify just the name to associate the latest revision. For example: arn:aws:apprunner:us-east-1:123456789012:autoscalingconfiguration/high-availability

encryptionConfigurationoptionalIResolvable | CfnService.EncryptionConfigurationPropertyencryption_configurationoptionaltyping.Union[IResolvable, EncryptionConfigurationProperty]encryptionConfigurationoptionalIResolvableEncryptionConfigurationoptionalIResolvableEncryptionConfigurationoptionalinterface{} #
An optional custom encryption key that App Runner uses to encrypt the copy of your source repository that it maintains and your service logs.

By default, App Runner uses an AWS managed key .

healthCheckConfigurationoptionalIResolvable | CfnService.HealthCheckConfigurationPropertyhealth_check_configurationoptionaltyping.Union[IResolvable, HealthCheckConfigurationProperty]healthCheckConfigurationoptionalIResolvableHealthCheckConfigurationoptionalIResolvableHealthCheckConfigurationoptionalinterface{} #
The settings for the health check that AWS App Runner performs to monitor the health of the App Runner service.
instanceConfigurationoptionalIResolvable | CfnService.InstanceConfigurationPropertyinstance_configurationoptionaltyping.Union[IResolvable, InstanceConfigurationProperty]instanceConfigurationoptionalIResolvableInstanceConfigurationoptionalIResolvableInstanceConfigurationoptionalinterface{} #
The runtime configuration of instances (scaling units) of your service.
networkConfigurationoptionalIResolvable | CfnService.NetworkConfigurationPropertynetwork_configurationoptionaltyping.Union[IResolvable, NetworkConfigurationProperty]networkConfigurationoptionalIResolvableNetworkConfigurationoptionalIResolvableNetworkConfigurationoptionalinterface{} #
Configuration settings related to network traffic of the web application that the App Runner service runs.
observabilityConfigurationoptionalIResolvable | CfnService.ServiceObservabilityConfigurationPropertyobservability_configurationoptionaltyping.Union[IResolvable, ServiceObservabilityConfigurationProperty]observabilityConfigurationoptionalIResolvableObservabilityConfigurationoptionalIResolvableObservabilityConfigurationoptionalinterface{} #
The observability configuration of your service.
serviceNameoptionalstringservice_nameoptionalstrserviceNameoptionalStringServiceNameoptionalstringServiceNameoptional*string #
A name for the App Runner service.

It must be unique across all the running App Runner services in your AWS account in the AWS Region .

If you don't specify a name, CloudFormation generates a name for your service.

sourceConfigurationIResolvable | CfnService.SourceConfigurationPropertysource_configurationtyping.Union[IResolvable, SourceConfigurationProperty]sourceConfigurationIResolvableSourceConfigurationIResolvableSourceConfigurationinterface{} required #
The source to deploy to the App Runner service.

It can be a code or an image repository.

tagsoptionalCfnTag[]tagsoptionaltyping.List[CfnTag]tagsoptionalList<CfnTag>TagsoptionalCfnTag[]Tagsoptional*[]CfnTag #
An optional list of metadata items that you can associate with the App Runner service resource.

A tag is a key-value pair.