aws-cdk.aws-apprunner-alpha


Nameaws-cdk.aws-apprunner-alpha JSON
Version 2.170.0a0 PyPI version JSON
download
home_pagehttps://github.com/aws/aws-cdk
SummaryThe CDK Construct Library for AWS::AppRunner
upload_time2024-11-22 04:42:15
maintainerNone
docs_urlNone
authorAmazon Web Services
requires_python~=3.8
licenseApache-2.0
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # AWS::AppRunner Construct Library

<!--BEGIN STABILITY BANNER-->---


![cdk-constructs: Experimental](https://img.shields.io/badge/cdk--constructs-experimental-important.svg?style=for-the-badge)

> The APIs of higher level constructs in this module are experimental and under active development.
> They are subject to non-backward compatible changes or removal in any future version. These are
> not subject to the [Semantic Versioning](https://semver.org/) model and breaking changes will be
> announced in the release notes. This means that while you may use them, you may need to update
> your source code when upgrading to a newer version of this package.

---
<!--END STABILITY BANNER-->

This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project.

```python
import aws_cdk.aws_apprunner_alpha as apprunner
```

## Introduction

AWS App Runner is a fully managed service that makes it easy for developers to quickly deploy containerized web applications and APIs, at scale and with no prior infrastructure experience required. Start with your source code or a container image. App Runner automatically builds and deploys the web application and load balances traffic with encryption. App Runner also scales up or down automatically to meet your traffic needs. With App Runner, rather than thinking about servers or scaling, you have more time to focus on your applications.

## Service

The `Service` construct allows you to create AWS App Runner services with `ECR Public`, `ECR` or `Github` with the `source` property in the following scenarios:

* `Source.fromEcr()` - To define the source repository from `ECR`.
* `Source.fromEcrPublic()` - To define the source repository from `ECR Public`.
* `Source.fromGitHub()` - To define the source repository from the `Github repository`.
* `Source.fromAsset()` - To define the source from local asset directory.

The `Service` construct implements `IGrantable`.

## ECR Public

To create a `Service` with ECR Public:

```python
apprunner.Service(self, "Service",
    source=apprunner.Source.from_ecr_public(
        image_configuration=apprunner.ImageConfiguration(port=8000),
        image_identifier="public.ecr.aws/aws-containers/hello-app-runner:latest"
    )
)
```

## ECR

To create a `Service` from an existing ECR repository:

```python
import aws_cdk.aws_ecr as ecr


apprunner.Service(self, "Service",
    source=apprunner.Source.from_ecr(
        image_configuration=apprunner.ImageConfiguration(port=80),
        repository=ecr.Repository.from_repository_name(self, "NginxRepository", "nginx"),
        tag_or_digest="latest"
    )
)
```

To create a `Service` from local docker image asset directory built and pushed to Amazon ECR:

You can specify whether to enable continuous integration from the source repository with the `autoDeploymentsEnabled` flag.

```python
import aws_cdk.aws_ecr_assets as assets


image_asset = assets.DockerImageAsset(self, "ImageAssets",
    directory=path.join(__dirname, "docker.assets")
)
apprunner.Service(self, "Service",
    source=apprunner.Source.from_asset(
        image_configuration=apprunner.ImageConfiguration(port=8000),
        asset=image_asset
    ),
    auto_deployments_enabled=True
)
```

## GitHub

To create a `Service` from the GitHub repository, you need to specify an existing App Runner `Connection`.

See [Managing App Runner connections](https://docs.aws.amazon.com/apprunner/latest/dg/manage-connections.html) for more details.

```python
apprunner.Service(self, "Service",
    source=apprunner.Source.from_git_hub(
        repository_url="https://github.com/aws-containers/hello-app-runner",
        branch="main",
        configuration_source=apprunner.ConfigurationSourceType.REPOSITORY,
        connection=apprunner.GitHubConnection.from_connection_arn("CONNECTION_ARN")
    )
)
```

Use `codeConfigurationValues` to override configuration values with the `API` configuration source type.

```python
apprunner.Service(self, "Service",
    source=apprunner.Source.from_git_hub(
        repository_url="https://github.com/aws-containers/hello-app-runner",
        branch="main",
        configuration_source=apprunner.ConfigurationSourceType.API,
        code_configuration_values=apprunner.CodeConfigurationValues(
            runtime=apprunner.Runtime.PYTHON_3,
            port="8000",
            start_command="python app.py",
            build_command="yum install -y pycairo && pip install -r requirements.txt"
        ),
        connection=apprunner.GitHubConnection.from_connection_arn("CONNECTION_ARN")
    )
)
```

## IAM Roles

You are allowed to define `instanceRole` and `accessRole` for the `Service`.

`instanceRole` - The IAM role that provides permissions to your App Runner service. These are permissions that
your code needs when it calls any AWS APIs. If not defined, a new instance role will be generated
when required.

To add IAM policy statements to this role, use `addToRolePolicy()`:

```python
import aws_cdk.aws_iam as iam


service = apprunner.Service(self, "Service",
    source=apprunner.Source.from_ecr_public(
        image_configuration=apprunner.ImageConfiguration(port=8000),
        image_identifier="public.ecr.aws/aws-containers/hello-app-runner:latest"
    )
)

service.add_to_role_policy(iam.PolicyStatement(
    effect=iam.Effect.ALLOW,
    actions=["s3:GetObject"],
    resources=["*"]
))
```

`accessRole` - 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). If not defined, a new access role will be generated
when required.

See [App Runner IAM Roles](https://docs.aws.amazon.com/apprunner/latest/dg/security_iam_service-with-iam.html#security_iam_service-with-iam-roles) for more details.

## Auto Scaling Configuration

To associate an App Runner service with a custom Auto Scaling Configuration, define `autoScalingConfiguration` for the service.

```python
auto_scaling_configuration = apprunner.AutoScalingConfiguration(self, "AutoScalingConfiguration",
    auto_scaling_configuration_name="MyAutoScalingConfiguration",
    max_concurrency=150,
    max_size=20,
    min_size=5
)

apprunner.Service(self, "DemoService",
    source=apprunner.Source.from_ecr_public(
        image_configuration=apprunner.ImageConfiguration(port=8000),
        image_identifier="public.ecr.aws/aws-containers/hello-app-runner:latest"
    ),
    auto_scaling_configuration=auto_scaling_configuration
)
```

## VPC Connector

To associate an App Runner service with a custom VPC, define `vpcConnector` for the service.

```python
import aws_cdk.aws_ec2 as ec2


vpc = ec2.Vpc(self, "Vpc",
    ip_addresses=ec2.IpAddresses.cidr("10.0.0.0/16")
)

vpc_connector = apprunner.VpcConnector(self, "VpcConnector",
    vpc=vpc,
    vpc_subnets=vpc.select_subnets(subnet_type=ec2.SubnetType.PUBLIC),
    vpc_connector_name="MyVpcConnector"
)

apprunner.Service(self, "Service",
    source=apprunner.Source.from_ecr_public(
        image_configuration=apprunner.ImageConfiguration(port=8000),
        image_identifier="public.ecr.aws/aws-containers/hello-app-runner:latest"
    ),
    vpc_connector=vpc_connector
)
```

## VPC Ingress Connection

To make your App Runner service private and only accessible from within a VPC use the `isPubliclyAccessible` property and associate it to a `VpcIngressConnection` resource.

To set up a `VpcIngressConnection`, specify a VPC, a VPC Interface Endpoint, and the App Runner service.
Also you must set `isPubliclyAccessible` property in ther `Service` to `false`.

For more information, see [Enabling Private endpoint for incoming traffic](https://docs.aws.amazon.com/apprunner/latest/dg/network-pl.html).

```python
import aws_cdk.aws_ec2 as ec2

# vpc: ec2.Vpc


interface_vpc_endpoint = ec2.InterfaceVpcEndpoint(self, "MyVpcEndpoint",
    vpc=vpc,
    service=ec2.InterfaceVpcEndpointAwsService.APP_RUNNER_REQUESTS,
    private_dns_enabled=False
)

service = apprunner.Service(self, "Service",
    source=apprunner.Source.from_ecr_public(
        image_configuration=apprunner.ImageConfiguration(
            port=8000
        ),
        image_identifier="public.ecr.aws/aws-containers/hello-app-runner:latest"
    ),
    is_publicly_accessible=False
)

apprunner.VpcIngressConnection(self, "VpcIngressConnection",
    vpc=vpc,
    interface_vpc_endpoint=interface_vpc_endpoint,
    service=service
)
```

## Dual Stack

To use dual stack (IPv4 and IPv6) for your incoming public network configuration, set `ipAddressType` to `IpAddressType.DUAL_STACK`.

```python
apprunner.Service(self, "Service",
    source=apprunner.Source.from_ecr_public(
        image_configuration=apprunner.ImageConfiguration(port=8000),
        image_identifier="public.ecr.aws/aws-containers/hello-app-runner:latest"
    ),
    ip_address_type=apprunner.IpAddressType.DUAL_STACK
)
```

**Note**: Currently, App Runner supports dual stack for only Public endpoint.
Only IPv4 is supported for Private endpoint.
If you update a service that's using dual-stack Public endpoint to a Private endpoint,
your App Runner service will default to support only IPv4 for Private endpoint and fail
to receive traffic originating from IPv6 endpoint.

## Secrets Manager

To include environment variables integrated with AWS Secrets Manager, use the `environmentSecrets` attribute.
You can use the `addSecret` method from the App Runner `Service` class to include secrets from outside the
service definition.

```python
import aws_cdk.aws_secretsmanager as secretsmanager
import aws_cdk.aws_ssm as ssm

# stack: Stack


secret = secretsmanager.Secret(stack, "Secret")
parameter = ssm.StringParameter.from_secure_string_parameter_attributes(stack, "Parameter",
    parameter_name="/name",
    version=1
)

service = apprunner.Service(stack, "Service",
    source=apprunner.Source.from_ecr_public(
        image_configuration=apprunner.ImageConfiguration(
            port=8000,
            environment_secrets={
                "SECRET": apprunner.Secret.from_secrets_manager(secret),
                "PARAMETER": apprunner.Secret.from_ssm_parameter(parameter),
                "SECRET_ID": apprunner.Secret.from_secrets_manager_version(secret, version_id="version-id"),
                "SECRET_STAGE": apprunner.Secret.from_secrets_manager_version(secret, version_stage="version-stage")
            }
        ),
        image_identifier="public.ecr.aws/aws-containers/hello-app-runner:latest"
    )
)

service.add_secret("LATER_SECRET", apprunner.Secret.from_secrets_manager(secret, "field"))
```

## Use a customer managed key

To use a customer managed key for your source encryption, use the `kmsKey` attribute.

```python
import aws_cdk.aws_kms as kms

# kms_key: kms.IKey


apprunner.Service(self, "Service",
    source=apprunner.Source.from_ecr_public(
        image_configuration=apprunner.ImageConfiguration(port=8000),
        image_identifier="public.ecr.aws/aws-containers/hello-app-runner:latest"
    ),
    kms_key=kms_key
)
```

## HealthCheck

To configure the health check for the service, use the `healthCheck` attribute.

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

```python
apprunner.Service(self, "Service",
    source=apprunner.Source.from_ecr_public(
        image_configuration=apprunner.ImageConfiguration(port=8000),
        image_identifier="public.ecr.aws/aws-containers/hello-app-runner:latest"
    ),
    health_check=apprunner.HealthCheck.http(
        healthy_threshold=5,
        interval=Duration.seconds(10),
        path="/",
        timeout=Duration.seconds(10),
        unhealthy_threshold=10
    )
)
```

## Observability Configuration

To associate an App Runner service with a custom observability configuration, use the `observabilityConfiguration` property.

```python
observability_configuration = apprunner.ObservabilityConfiguration(self, "ObservabilityConfiguration",
    observability_configuration_name="MyObservabilityConfiguration",
    trace_configuration_vendor=apprunner.TraceConfigurationVendor.AWSXRAY
)

apprunner.Service(self, "DemoService",
    source=apprunner.Source.from_ecr_public(
        image_configuration=apprunner.ImageConfiguration(port=8000),
        image_identifier="public.ecr.aws/aws-containers/hello-app-runner:latest"
    ),
    observability_configuration=observability_configuration
)
```

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/aws/aws-cdk",
    "name": "aws-cdk.aws-apprunner-alpha",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "~=3.8",
    "maintainer_email": null,
    "keywords": null,
    "author": "Amazon Web Services",
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/51/b5/d57880e7f52655a06c2706acf024312cd591cdbd399d572e9e9fa05d8a69/aws_cdk_aws_apprunner_alpha-2.170.0a0.tar.gz",
    "platform": null,
    "description": "# AWS::AppRunner Construct Library\n\n<!--BEGIN STABILITY BANNER-->---\n\n\n![cdk-constructs: Experimental](https://img.shields.io/badge/cdk--constructs-experimental-important.svg?style=for-the-badge)\n\n> The APIs of higher level constructs in this module are experimental and under active development.\n> They are subject to non-backward compatible changes or removal in any future version. These are\n> not subject to the [Semantic Versioning](https://semver.org/) model and breaking changes will be\n> announced in the release notes. This means that while you may use them, you may need to update\n> your source code when upgrading to a newer version of this package.\n\n---\n<!--END STABILITY BANNER-->\n\nThis module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project.\n\n```python\nimport aws_cdk.aws_apprunner_alpha as apprunner\n```\n\n## Introduction\n\nAWS App Runner is a fully managed service that makes it easy for developers to quickly deploy containerized web applications and APIs, at scale and with no prior infrastructure experience required. Start with your source code or a container image. App Runner automatically builds and deploys the web application and load balances traffic with encryption. App Runner also scales up or down automatically to meet your traffic needs. With App Runner, rather than thinking about servers or scaling, you have more time to focus on your applications.\n\n## Service\n\nThe `Service` construct allows you to create AWS App Runner services with `ECR Public`, `ECR` or `Github` with the `source` property in the following scenarios:\n\n* `Source.fromEcr()` - To define the source repository from `ECR`.\n* `Source.fromEcrPublic()` - To define the source repository from `ECR Public`.\n* `Source.fromGitHub()` - To define the source repository from the `Github repository`.\n* `Source.fromAsset()` - To define the source from local asset directory.\n\nThe `Service` construct implements `IGrantable`.\n\n## ECR Public\n\nTo create a `Service` with ECR Public:\n\n```python\napprunner.Service(self, \"Service\",\n    source=apprunner.Source.from_ecr_public(\n        image_configuration=apprunner.ImageConfiguration(port=8000),\n        image_identifier=\"public.ecr.aws/aws-containers/hello-app-runner:latest\"\n    )\n)\n```\n\n## ECR\n\nTo create a `Service` from an existing ECR repository:\n\n```python\nimport aws_cdk.aws_ecr as ecr\n\n\napprunner.Service(self, \"Service\",\n    source=apprunner.Source.from_ecr(\n        image_configuration=apprunner.ImageConfiguration(port=80),\n        repository=ecr.Repository.from_repository_name(self, \"NginxRepository\", \"nginx\"),\n        tag_or_digest=\"latest\"\n    )\n)\n```\n\nTo create a `Service` from local docker image asset directory built and pushed to Amazon ECR:\n\nYou can specify whether to enable continuous integration from the source repository with the `autoDeploymentsEnabled` flag.\n\n```python\nimport aws_cdk.aws_ecr_assets as assets\n\n\nimage_asset = assets.DockerImageAsset(self, \"ImageAssets\",\n    directory=path.join(__dirname, \"docker.assets\")\n)\napprunner.Service(self, \"Service\",\n    source=apprunner.Source.from_asset(\n        image_configuration=apprunner.ImageConfiguration(port=8000),\n        asset=image_asset\n    ),\n    auto_deployments_enabled=True\n)\n```\n\n## GitHub\n\nTo create a `Service` from the GitHub repository, you need to specify an existing App Runner `Connection`.\n\nSee [Managing App Runner connections](https://docs.aws.amazon.com/apprunner/latest/dg/manage-connections.html) for more details.\n\n```python\napprunner.Service(self, \"Service\",\n    source=apprunner.Source.from_git_hub(\n        repository_url=\"https://github.com/aws-containers/hello-app-runner\",\n        branch=\"main\",\n        configuration_source=apprunner.ConfigurationSourceType.REPOSITORY,\n        connection=apprunner.GitHubConnection.from_connection_arn(\"CONNECTION_ARN\")\n    )\n)\n```\n\nUse `codeConfigurationValues` to override configuration values with the `API` configuration source type.\n\n```python\napprunner.Service(self, \"Service\",\n    source=apprunner.Source.from_git_hub(\n        repository_url=\"https://github.com/aws-containers/hello-app-runner\",\n        branch=\"main\",\n        configuration_source=apprunner.ConfigurationSourceType.API,\n        code_configuration_values=apprunner.CodeConfigurationValues(\n            runtime=apprunner.Runtime.PYTHON_3,\n            port=\"8000\",\n            start_command=\"python app.py\",\n            build_command=\"yum install -y pycairo && pip install -r requirements.txt\"\n        ),\n        connection=apprunner.GitHubConnection.from_connection_arn(\"CONNECTION_ARN\")\n    )\n)\n```\n\n## IAM Roles\n\nYou are allowed to define `instanceRole` and `accessRole` for the `Service`.\n\n`instanceRole` - The IAM role that provides permissions to your App Runner service. These are permissions that\nyour code needs when it calls any AWS APIs. If not defined, a new instance role will be generated\nwhen required.\n\nTo add IAM policy statements to this role, use `addToRolePolicy()`:\n\n```python\nimport aws_cdk.aws_iam as iam\n\n\nservice = apprunner.Service(self, \"Service\",\n    source=apprunner.Source.from_ecr_public(\n        image_configuration=apprunner.ImageConfiguration(port=8000),\n        image_identifier=\"public.ecr.aws/aws-containers/hello-app-runner:latest\"\n    )\n)\n\nservice.add_to_role_policy(iam.PolicyStatement(\n    effect=iam.Effect.ALLOW,\n    actions=[\"s3:GetObject\"],\n    resources=[\"*\"]\n))\n```\n\n`accessRole` - The IAM role that grants the App Runner service access to a source repository. It's required for\nECR image repositories (but not for ECR Public repositories). If not defined, a new access role will be generated\nwhen required.\n\nSee [App Runner IAM Roles](https://docs.aws.amazon.com/apprunner/latest/dg/security_iam_service-with-iam.html#security_iam_service-with-iam-roles) for more details.\n\n## Auto Scaling Configuration\n\nTo associate an App Runner service with a custom Auto Scaling Configuration, define `autoScalingConfiguration` for the service.\n\n```python\nauto_scaling_configuration = apprunner.AutoScalingConfiguration(self, \"AutoScalingConfiguration\",\n    auto_scaling_configuration_name=\"MyAutoScalingConfiguration\",\n    max_concurrency=150,\n    max_size=20,\n    min_size=5\n)\n\napprunner.Service(self, \"DemoService\",\n    source=apprunner.Source.from_ecr_public(\n        image_configuration=apprunner.ImageConfiguration(port=8000),\n        image_identifier=\"public.ecr.aws/aws-containers/hello-app-runner:latest\"\n    ),\n    auto_scaling_configuration=auto_scaling_configuration\n)\n```\n\n## VPC Connector\n\nTo associate an App Runner service with a custom VPC, define `vpcConnector` for the service.\n\n```python\nimport aws_cdk.aws_ec2 as ec2\n\n\nvpc = ec2.Vpc(self, \"Vpc\",\n    ip_addresses=ec2.IpAddresses.cidr(\"10.0.0.0/16\")\n)\n\nvpc_connector = apprunner.VpcConnector(self, \"VpcConnector\",\n    vpc=vpc,\n    vpc_subnets=vpc.select_subnets(subnet_type=ec2.SubnetType.PUBLIC),\n    vpc_connector_name=\"MyVpcConnector\"\n)\n\napprunner.Service(self, \"Service\",\n    source=apprunner.Source.from_ecr_public(\n        image_configuration=apprunner.ImageConfiguration(port=8000),\n        image_identifier=\"public.ecr.aws/aws-containers/hello-app-runner:latest\"\n    ),\n    vpc_connector=vpc_connector\n)\n```\n\n## VPC Ingress Connection\n\nTo make your App Runner service private and only accessible from within a VPC use the `isPubliclyAccessible` property and associate it to a `VpcIngressConnection` resource.\n\nTo set up a `VpcIngressConnection`, specify a VPC, a VPC Interface Endpoint, and the App Runner service.\nAlso you must set `isPubliclyAccessible` property in ther `Service` to `false`.\n\nFor more information, see [Enabling Private endpoint for incoming traffic](https://docs.aws.amazon.com/apprunner/latest/dg/network-pl.html).\n\n```python\nimport aws_cdk.aws_ec2 as ec2\n\n# vpc: ec2.Vpc\n\n\ninterface_vpc_endpoint = ec2.InterfaceVpcEndpoint(self, \"MyVpcEndpoint\",\n    vpc=vpc,\n    service=ec2.InterfaceVpcEndpointAwsService.APP_RUNNER_REQUESTS,\n    private_dns_enabled=False\n)\n\nservice = apprunner.Service(self, \"Service\",\n    source=apprunner.Source.from_ecr_public(\n        image_configuration=apprunner.ImageConfiguration(\n            port=8000\n        ),\n        image_identifier=\"public.ecr.aws/aws-containers/hello-app-runner:latest\"\n    ),\n    is_publicly_accessible=False\n)\n\napprunner.VpcIngressConnection(self, \"VpcIngressConnection\",\n    vpc=vpc,\n    interface_vpc_endpoint=interface_vpc_endpoint,\n    service=service\n)\n```\n\n## Dual Stack\n\nTo use dual stack (IPv4 and IPv6) for your incoming public network configuration, set `ipAddressType` to `IpAddressType.DUAL_STACK`.\n\n```python\napprunner.Service(self, \"Service\",\n    source=apprunner.Source.from_ecr_public(\n        image_configuration=apprunner.ImageConfiguration(port=8000),\n        image_identifier=\"public.ecr.aws/aws-containers/hello-app-runner:latest\"\n    ),\n    ip_address_type=apprunner.IpAddressType.DUAL_STACK\n)\n```\n\n**Note**: Currently, App Runner supports dual stack for only Public endpoint.\nOnly IPv4 is supported for Private endpoint.\nIf you update a service that's using dual-stack Public endpoint to a Private endpoint,\nyour App Runner service will default to support only IPv4 for Private endpoint and fail\nto receive traffic originating from IPv6 endpoint.\n\n## Secrets Manager\n\nTo include environment variables integrated with AWS Secrets Manager, use the `environmentSecrets` attribute.\nYou can use the `addSecret` method from the App Runner `Service` class to include secrets from outside the\nservice definition.\n\n```python\nimport aws_cdk.aws_secretsmanager as secretsmanager\nimport aws_cdk.aws_ssm as ssm\n\n# stack: Stack\n\n\nsecret = secretsmanager.Secret(stack, \"Secret\")\nparameter = ssm.StringParameter.from_secure_string_parameter_attributes(stack, \"Parameter\",\n    parameter_name=\"/name\",\n    version=1\n)\n\nservice = apprunner.Service(stack, \"Service\",\n    source=apprunner.Source.from_ecr_public(\n        image_configuration=apprunner.ImageConfiguration(\n            port=8000,\n            environment_secrets={\n                \"SECRET\": apprunner.Secret.from_secrets_manager(secret),\n                \"PARAMETER\": apprunner.Secret.from_ssm_parameter(parameter),\n                \"SECRET_ID\": apprunner.Secret.from_secrets_manager_version(secret, version_id=\"version-id\"),\n                \"SECRET_STAGE\": apprunner.Secret.from_secrets_manager_version(secret, version_stage=\"version-stage\")\n            }\n        ),\n        image_identifier=\"public.ecr.aws/aws-containers/hello-app-runner:latest\"\n    )\n)\n\nservice.add_secret(\"LATER_SECRET\", apprunner.Secret.from_secrets_manager(secret, \"field\"))\n```\n\n## Use a customer managed key\n\nTo use a customer managed key for your source encryption, use the `kmsKey` attribute.\n\n```python\nimport aws_cdk.aws_kms as kms\n\n# kms_key: kms.IKey\n\n\napprunner.Service(self, \"Service\",\n    source=apprunner.Source.from_ecr_public(\n        image_configuration=apprunner.ImageConfiguration(port=8000),\n        image_identifier=\"public.ecr.aws/aws-containers/hello-app-runner:latest\"\n    ),\n    kms_key=kms_key\n)\n```\n\n## HealthCheck\n\nTo configure the health check for the service, use the `healthCheck` attribute.\n\nYou can specify it by static methods `HealthCheck.http` or `HealthCheck.tcp`.\n\n```python\napprunner.Service(self, \"Service\",\n    source=apprunner.Source.from_ecr_public(\n        image_configuration=apprunner.ImageConfiguration(port=8000),\n        image_identifier=\"public.ecr.aws/aws-containers/hello-app-runner:latest\"\n    ),\n    health_check=apprunner.HealthCheck.http(\n        healthy_threshold=5,\n        interval=Duration.seconds(10),\n        path=\"/\",\n        timeout=Duration.seconds(10),\n        unhealthy_threshold=10\n    )\n)\n```\n\n## Observability Configuration\n\nTo associate an App Runner service with a custom observability configuration, use the `observabilityConfiguration` property.\n\n```python\nobservability_configuration = apprunner.ObservabilityConfiguration(self, \"ObservabilityConfiguration\",\n    observability_configuration_name=\"MyObservabilityConfiguration\",\n    trace_configuration_vendor=apprunner.TraceConfigurationVendor.AWSXRAY\n)\n\napprunner.Service(self, \"DemoService\",\n    source=apprunner.Source.from_ecr_public(\n        image_configuration=apprunner.ImageConfiguration(port=8000),\n        image_identifier=\"public.ecr.aws/aws-containers/hello-app-runner:latest\"\n    ),\n    observability_configuration=observability_configuration\n)\n```\n",
    "bugtrack_url": null,
    "license": "Apache-2.0",
    "summary": "The CDK Construct Library for AWS::AppRunner",
    "version": "2.170.0a0",
    "project_urls": {
        "Homepage": "https://github.com/aws/aws-cdk",
        "Source": "https://github.com/aws/aws-cdk.git"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "18646cb4ab1cd5883870b0f6f723fb123bf1fbb4c311f28bd1d9b6e7736c7ad3",
                "md5": "8fd02034f3dd1adc438f8065c733aece",
                "sha256": "688c0c447896587d799ad1a2f2079a514508bc87f4c41cacd3093eb8f4f1f438"
            },
            "downloads": -1,
            "filename": "aws_cdk.aws_apprunner_alpha-2.170.0a0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "8fd02034f3dd1adc438f8065c733aece",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "~=3.8",
            "size": 160825,
            "upload_time": "2024-11-22T04:41:22",
            "upload_time_iso_8601": "2024-11-22T04:41:22.885682Z",
            "url": "https://files.pythonhosted.org/packages/18/64/6cb4ab1cd5883870b0f6f723fb123bf1fbb4c311f28bd1d9b6e7736c7ad3/aws_cdk.aws_apprunner_alpha-2.170.0a0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "51b5d57880e7f52655a06c2706acf024312cd591cdbd399d572e9e9fa05d8a69",
                "md5": "b9de2927cabfb9474fa798d0cf133ab9",
                "sha256": "1d0ac4791a7ab5aa84950acccfcca71931b176311d0338b0b64945a40571be08"
            },
            "downloads": -1,
            "filename": "aws_cdk_aws_apprunner_alpha-2.170.0a0.tar.gz",
            "has_sig": false,
            "md5_digest": "b9de2927cabfb9474fa798d0cf133ab9",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "~=3.8",
            "size": 162897,
            "upload_time": "2024-11-22T04:42:15",
            "upload_time_iso_8601": "2024-11-22T04:42:15.047627Z",
            "url": "https://files.pythonhosted.org/packages/51/b5/d57880e7f52655a06c2706acf024312cd591cdbd399d572e9e9fa05d8a69/aws_cdk_aws_apprunner_alpha-2.170.0a0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-11-22 04:42:15",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "aws",
    "github_project": "aws-cdk",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "aws-cdk.aws-apprunner-alpha"
}
        
Elapsed time: 0.41353s