Skip to content
v2.273.0

ServiceProps Struct ​

Properties of the AppRunner Service.

Example ​

ts
import * as iam from 'aws-cdk-lib/aws-iam';

const service = new apprunner.Service(this, 'Service', {
  source: apprunner.Source.fromEcrPublic({
    imageConfiguration: { port: 8000 },
    imageIdentifier: 'public.ecr.aws/aws-containers/hello-app-runner:latest',
  }),
});

service.addToRolePolicy(new iam.PolicyStatement({
  effect: iam.Effect.ALLOW,
  actions: ['s3:GetObject'],
  resources: ['*'],
}))

Properties ​

accessRoleIRoleaccess_roleIRoleaccessRoleIRoleAccessRoleIRoleAccessRoleIRole= generate a new access role.#
The IAM role that grants the App Runner service access to a source repository.

It's required for ECR image repositories (but not for ECR Public repositories).

The role must be assumable by the 'build.apprunner.amazonaws.com' service principal.

autoDeploymentsEnabledbooleanauto_deployments_enabledboolautoDeploymentsEnabledBooleanAutoDeploymentsEnabledboolAutoDeploymentsEnabled*bool= no value will be passed.#
Specifies whether to enable continuous integration from the source repository.
notes

If true, continuous integration from the source repository is enabled for the App Runner service. Each repository change (including any source code commit or new image version) starts a deployment. By default, App Runner sets to false for a source image that uses an ECR Public repository or an ECR repository that's in an AWS account other than the one that the service is in. App Runner sets to true in all other cases (which currently include a source code repository or a source image using a same-account ECR repository).

autoScalingConfigurationIAutoScalingConfigurationauto_scaling_configurationIAutoScalingConfigurationautoScalingConfigurationIAutoScalingConfigurationAutoScalingConfigurationIAutoScalingConfigurationAutoScalingConfigurationIAutoScalingConfiguration= the latest revision of a default…#
Specifies an App Runner Auto Scaling Configuration.

A default configuration is either the AWS recommended configuration, or the configuration you set as the default.

default

Default: the latest revision of a default auto scaling configuration is used.

cpuCpucpuCpucpuCpuCpuCpuCpuCpu= Cpu.ONE_VCPU#
The number of CPU units reserved for each instance of your App Runner service.
healthCheckHealthCheckhealth_checkHealthCheckhealthCheckHealthCheckHealthCheckHealthCheckHealthCheckHealthCheck= no health check configuration#
Settings for the health check that AWS App Runner performs to monitor the health of a service.

You can specify it by static methods HealthCheck.http or HealthCheck.tcp.

instanceRoleIRoleinstance_roleIRoleinstanceRoleIRoleInstanceRoleIRoleInstanceRoleIRole= generate a new instance role.#
The IAM role that provides permissions to your App Runner service.

These are permissions that your code needs when it calls any AWS APIs.

The role must be assumable by the 'tasks.apprunner.amazonaws.com' service principal.

ipAddressTypeIpAddressTypeip_address_typeIpAddressTypeipAddressTypeIpAddressTypeIpAddressTypeIpAddressTypeIpAddressTypeIpAddressType= IpAddressType.IPV4#
The IP address type for your incoming public network configuration.
isPubliclyAccessiblebooleanis_publicly_accessibleboolisPubliclyAccessibleBooleanIsPubliclyAccessibleboolIsPubliclyAccessible*bool= true#
Specifies whether your App Runner service is publicly accessible.

If you use VpcIngressConnection, you must set this property to false.

kmsKeyIKeyRefkms_keyIKeyRefkmsKeyIKeyRefKmsKeyIKeyRefKmsKeyIKeyRef= Use an AWS managed key#
The customer managed key that AWS App Runner uses to encrypt copies of the source repository and service logs.
memoryMemorymemoryMemorymemoryMemoryMemoryMemoryMemoryMemory= Memory.TWO_GB#
The amount of memory reserved for each instance of your App Runner service.
observabilityConfigurationIObservabilityConfigurationobservability_configurationIObservabilityConfigurationobservabilityConfigurationIObservabilityConfigurationObservabilityConfigurationIObservabilityConfigurationObservabilityConfigurationIObservabilityConfiguration= no observability configuration r…#
Settings for an App Runner observability configuration.
default

Default: no observability configuration resource is associated with the service.

serviceNamestringservice_namestrserviceNameStringServiceNamestringServiceName*string= auto-generated if undefined.#
Name of the service.
sourceSourcesourceSourcesourceSourceSourceSourceSourceSourcerequired#
The source of the repository for the service.
vpcConnectorIVpcConnectorvpc_connectorIVpcConnectorvpcConnectorIVpcConnectorVpcConnectorIVpcConnectorVpcConnectorIVpcConnector= no VPC connector, uses the DEFAU…#
Settings for an App Runner VPC connector to associate with the service.
default

Default: no VPC connector, uses the DEFAULT egress type instead

Used as props by ​