Skip to main content

The CDK Construct Library for AWS::AppRunner

Project description

AWS::AppRunner Construct Library

---

cdk-constructs: Experimental

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 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.


This module is part of the AWS Cloud Development Kit project.

# Example automatically generated. See https://github.com/aws/jsii/issues/826
import aws_cdk.aws_apprunner 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.

ECR Public

To create a Service with ECR Public:

# Example automatically generated without compilation. See https://github.com/aws/jsii/issues/826
Service(stack, "Service",
    source=Source.from_ecr_public(
        image_configuration={"port": 8000},
        image_identifier="public.ecr.aws/aws-containers/hello-app-runner:latest"
    )
)

ECR

To create a Service from an existing ECR repository:

# Example automatically generated without compilation. See https://github.com/aws/jsii/issues/826
Service(stack, "Service",
    source=Source.from_ecr(
        image_configuration={"port": 80},
        repository=ecr.Repository.from_repository_name(stack, "NginxRepository", "nginx"),
        tag="latest"
    )
)

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

# Example automatically generated without compilation. See https://github.com/aws/jsii/issues/826
image_asset = assets.DockerImageAsset(stack, "ImageAssets",
    directory=path.join(__dirname, "./docker.assets")
)
Service(stack, "Service",
    source=Source.from_asset(
        image_configuration={"port": 8000},
        asset=image_asset
    )
)

GitHub

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

See Managing App Runner connections for more details.

# Example automatically generated without compilation. See https://github.com/aws/jsii/issues/826
Service(stack, "Service",
    source=Source.from_git_hub(
        repository_url="https://github.com/aws-containers/hello-app-runner",
        branch="main",
        configuration_source=ConfigurationSourceType.REPOSITORY,
        connection=GitHubConnection.from_connection_arn("CONNECTION_ARN")
    )
)

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

# Example automatically generated without compilation. See https://github.com/aws/jsii/issues/826
Service(stack, "Service",
    source=Source.from_git_hub(
        repository_url="https://github.com/aws-containers/hello-app-runner",
        branch="main",
        configuration_source=ConfigurationSourceType.API,
        code_configuration_values={
            "runtime": Runtime.PYTHON_3,
            "port": "8000",
            "start_command": "python app.py",
            "build_command": "yum install -y pycairo && pip install -r requirements.txt"
        },
        connection=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.

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 for more details.

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

aws-cdk.aws-apprunner-alpha-2.0.0a6.tar.gz (313.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

aws_cdk.aws_apprunner_alpha-2.0.0a6-py3-none-any.whl (312.4 kB view details)

Uploaded Python 3

File details

Details for the file aws-cdk.aws-apprunner-alpha-2.0.0a6.tar.gz.

File metadata

  • Download URL: aws-cdk.aws-apprunner-alpha-2.0.0a6.tar.gz
  • Upload date:
  • Size: 313.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.6.5

File hashes

Hashes for aws-cdk.aws-apprunner-alpha-2.0.0a6.tar.gz
Algorithm Hash digest
SHA256 30fee667f94f0e50a0bb7687bf5660373b0e9e2102e7c41a24a385001162c449
MD5 68df0e31c95cbe0198504aa6a9dc5f94
BLAKE2b-256 f73a696a86182df1025c0985bb55ed6c6427c36427c7555398dd5c05b8c0260b

See more details on using hashes here.

File details

Details for the file aws_cdk.aws_apprunner_alpha-2.0.0a6-py3-none-any.whl.

File metadata

  • Download URL: aws_cdk.aws_apprunner_alpha-2.0.0a6-py3-none-any.whl
  • Upload date:
  • Size: 312.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.6.5

File hashes

Hashes for aws_cdk.aws_apprunner_alpha-2.0.0a6-py3-none-any.whl
Algorithm Hash digest
SHA256 b76d8ab66a2a0c919fd3522f528d221d774e682154755cf93942ff074aa5a4dc
MD5 28dad8e97c591b1eec1a2c55c2754d11
BLAKE2b-256 d23034b72ca62d29ac8b839c3d5cf2e247b95a98ac442be389b3f2af81f99ba6

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page