awscdkapprunneralpha

package module
v2.94.0-alpha.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 1, 2023 License: Apache-2.0 Imports: 13 Imported by: 0

README

AWS::AppRunner Construct Library

---

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.

import apprunner "github.com/aws/aws-cdk-go/awscdkapprunneralpha"

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:

apprunner.NewService(this, jsii.String("Service"), &ServiceProps{
	Source: apprunner.Source_FromEcrPublic(&EcrPublicProps{
		ImageConfiguration: &ImageConfiguration{
			Port: jsii.Number(8000),
		},
		ImageIdentifier: jsii.String("public.ecr.aws/aws-containers/hello-app-runner:latest"),
	}),
})

ECR

To create a Service from an existing ECR repository:

import ecr "github.com/aws/aws-cdk-go/awscdk"


apprunner.NewService(this, jsii.String("Service"), &ServiceProps{
	Source: apprunner.Source_FromEcr(&EcrProps{
		ImageConfiguration: &ImageConfiguration{
			Port: jsii.Number(80),
		},
		Repository: ecr.Repository_FromRepositoryName(this, jsii.String("NginxRepository"), jsii.String("nginx")),
		TagOrDigest: jsii.String("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.

import assets "github.com/aws/aws-cdk-go/awscdk"


imageAsset := assets.NewDockerImageAsset(this, jsii.String("ImageAssets"), &DockerImageAssetProps{
	Directory: path.join(__dirname, jsii.String("./docker.assets")),
})
apprunner.NewService(this, jsii.String("Service"), &ServiceProps{
	Source: apprunner.Source_FromAsset(&AssetProps{
		ImageConfiguration: &ImageConfiguration{
			Port: jsii.Number(8000),
		},
		Asset: imageAsset,
	}),
	AutoDeploymentsEnabled: jsii.Boolean(true),
})

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.

apprunner.NewService(this, jsii.String("Service"), &ServiceProps{
	Source: apprunner.Source_FromGitHub(&GithubRepositoryProps{
		RepositoryUrl: jsii.String("https://github.com/aws-containers/hello-app-runner"),
		Branch: jsii.String("main"),
		ConfigurationSource: apprunner.ConfigurationSourceType_REPOSITORY,
		Connection: apprunner.GitHubConnection_FromConnectionArn(jsii.String("CONNECTION_ARN")),
	}),
})

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

apprunner.NewService(this, jsii.String("Service"), &ServiceProps{
	Source: apprunner.Source_FromGitHub(&GithubRepositoryProps{
		RepositoryUrl: jsii.String("https://github.com/aws-containers/hello-app-runner"),
		Branch: jsii.String("main"),
		ConfigurationSource: apprunner.ConfigurationSourceType_API,
		CodeConfigurationValues: &CodeConfigurationValues{
			Runtime: apprunner.Runtime_PYTHON_3(),
			Port: jsii.String("8000"),
			StartCommand: jsii.String("python app.py"),
			BuildCommand: jsii.String("yum install -y pycairo && pip install -r requirements.txt"),
		},
		Connection: apprunner.GitHubConnection_FromConnectionArn(jsii.String("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():

import "github.com/aws/aws-cdk-go/awscdk"


service := apprunner.NewService(this, jsii.String("Service"), &ServiceProps{
	Source: apprunner.Source_FromEcrPublic(&EcrPublicProps{
		ImageConfiguration: &ImageConfiguration{
			Port: jsii.Number(8000),
		},
		ImageIdentifier: jsii.String("public.ecr.aws/aws-containers/hello-app-runner:latest"),
	}),
})

service.AddToRolePolicy(iam.NewPolicyStatement(&PolicyStatementProps{
	Effect: iam.Effect_ALLOW,
	Actions: []*string{
		jsii.String("s3:GetObject"),
	},
	Resources: []*string{
		jsii.String("*"),
	},
}))

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.

VPC Connector

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

import "github.com/aws/aws-cdk-go/awscdk"


vpc := ec2.NewVpc(this, jsii.String("Vpc"), &VpcProps{
	IpAddresses: ec2.IpAddresses_Cidr(jsii.String("10.0.0.0/16")),
})

vpcConnector := apprunner.NewVpcConnector(this, jsii.String("VpcConnector"), &VpcConnectorProps{
	Vpc: Vpc,
	VpcSubnets: vpc.selectSubnets(&SubnetSelection{
		SubnetType: ec2.SubnetType_PUBLIC,
	}),
	VpcConnectorName: jsii.String("MyVpcConnector"),
})

apprunner.NewService(this, jsii.String("Service"), &ServiceProps{
	Source: apprunner.Source_FromEcrPublic(&EcrPublicProps{
		ImageConfiguration: &ImageConfiguration{
			Port: jsii.Number(8000),
		},
		ImageIdentifier: jsii.String("public.ecr.aws/aws-containers/hello-app-runner:latest"),
	}),
	VpcConnector: VpcConnector,
})

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.

import secretsmanager "github.com/aws/aws-cdk-go/awscdk"
import ssm "github.com/aws/aws-cdk-go/awscdk"

var stack stack


secret := secretsmanager.NewSecret(stack, jsii.String("Secret"))
parameter := ssm.StringParameter_FromSecureStringParameterAttributes(stack, jsii.String("Parameter"), &SecureStringParameterAttributes{
	ParameterName: jsii.String("/name"),
	Version: jsii.Number(1),
})

service := apprunner.NewService(stack, jsii.String("Service"), &ServiceProps{
	Source: apprunner.Source_FromEcrPublic(&EcrPublicProps{
		ImageConfiguration: &ImageConfiguration{
			Port: jsii.Number(8000),
			EnvironmentSecrets: map[string]secret{
				"SECRET": apprunner.*secret_fromSecretsManager(secret),
				"PARAMETER": apprunner.*secret_fromSsmParameter(parameter),
				"SECRET_ID": apprunner.*secret_fromSecretsManagerVersion(secret, &SecretVersionInfo{
					"versionId": jsii.String("version-id"),
				}),
				"SECRET_STAGE": apprunner.*secret_fromSecretsManagerVersion(secret, &SecretVersionInfo{
					"versionStage": jsii.String("version-stage"),
				}),
			},
		},
		ImageIdentifier: jsii.String("public.ecr.aws/aws-containers/hello-app-runner:latest"),
	}),
})

service.AddSecret(jsii.String("LATER_SECRET"), apprunner.secret_FromSecretsManager(secret, jsii.String("field")))

Documentation

Overview

The CDK Construct Library for AWS::AppRunner

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewAssetSource_Override

func NewAssetSource_Override(a AssetSource, props *AssetProps)

Experimental.

func NewEcrPublicSource_Override

func NewEcrPublicSource_Override(e EcrPublicSource, props *EcrPublicProps)

Experimental.

func NewEcrSource_Override

func NewEcrSource_Override(e EcrSource, props *EcrProps)

Experimental.

func NewGitHubConnection_Override

func NewGitHubConnection_Override(g GitHubConnection, arn *string)

Experimental.

func NewGithubSource_Override

func NewGithubSource_Override(g GithubSource, props *GithubRepositoryProps)

Experimental.

func NewSecret_Override

func NewSecret_Override(s Secret)

Experimental.

func NewService_Override

func NewService_Override(s Service, scope constructs.Construct, id *string, props *ServiceProps)

Experimental.

func NewSource_Override

func NewSource_Override(s Source)

Experimental.

func NewVpcConnector_Override

func NewVpcConnector_Override(v VpcConnector, scope constructs.Construct, id *string, props *VpcConnectorProps)

Experimental.

func Service_IsConstruct

func Service_IsConstruct(x interface{}) *bool

Checks if `x` is a construct.

Use this method instead of `instanceof` to properly detect `Construct` instances, even when the construct library is symlinked.

Explanation: in JavaScript, multiple copies of the `constructs` library on disk are seen as independent, completely different libraries. As a consequence, the class `Construct` in each copy of the `constructs` library is seen as a different class, and an instance of one class will not test as `instanceof` the other class. `npm install` will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the `constructs` library can be accidentally installed, and `instanceof` will behave unpredictably. It is safest to avoid using `instanceof`, and using this type-testing method instead.

Returns: true if `x` is an object created from a class which extends `Construct`. Experimental.

func Service_IsOwnedResource

func Service_IsOwnedResource(construct constructs.IConstruct) *bool

Returns true if the construct was created by CDK, and false otherwise. Experimental.

func Service_IsResource

func Service_IsResource(construct constructs.IConstruct) *bool

Check whether the given construct is a Resource. Experimental.

func VpcConnector_IsConstruct

func VpcConnector_IsConstruct(x interface{}) *bool

Checks if `x` is a construct.

Use this method instead of `instanceof` to properly detect `Construct` instances, even when the construct library is symlinked.

Explanation: in JavaScript, multiple copies of the `constructs` library on disk are seen as independent, completely different libraries. As a consequence, the class `Construct` in each copy of the `constructs` library is seen as a different class, and an instance of one class will not test as `instanceof` the other class. `npm install` will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the `constructs` library can be accidentally installed, and `instanceof` will behave unpredictably. It is safest to avoid using `instanceof`, and using this type-testing method instead.

Returns: true if `x` is an object created from a class which extends `Construct`. Experimental.

func VpcConnector_IsOwnedResource

func VpcConnector_IsOwnedResource(construct constructs.IConstruct) *bool

Returns true if the construct was created by CDK, and false otherwise. Experimental.

func VpcConnector_IsResource

func VpcConnector_IsResource(construct constructs.IConstruct) *bool

Check whether the given construct is a Resource. Experimental.

Types

type AssetProps

type AssetProps struct {
	// Represents the docker image asset.
	// Experimental.
	Asset awsecrassets.DockerImageAsset `field:"required" json:"asset" yaml:"asset"`
	// The image configuration for the image built from the asset.
	// See: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apprunner-service-imageconfiguration.html#cfn-apprunner-service-imageconfiguration-port
	//
	// Default: - no image configuration will be passed. The default `port` will be 8080.
	//
	// Experimental.
	ImageConfiguration *ImageConfiguration `field:"optional" json:"imageConfiguration" yaml:"imageConfiguration"`
}

Properties of the image repository for `Source.fromAsset()`.

Example:

import assets "github.com/aws/aws-cdk-go/awscdk"

imageAsset := assets.NewDockerImageAsset(this, jsii.String("ImageAssets"), &DockerImageAssetProps{
	Directory: path.join(__dirname, jsii.String("./docker.assets")),
})
apprunner.NewService(this, jsii.String("Service"), &ServiceProps{
	Source: apprunner.Source_FromAsset(&AssetProps{
		ImageConfiguration: &ImageConfiguration{
			Port: jsii.Number(8000),
		},
		Asset: imageAsset,
	}),
	AutoDeploymentsEnabled: jsii.Boolean(true),
})

Experimental.

type AssetSource

type AssetSource interface {
	Source
	// Called when the Job is initialized to allow this object to bind.
	// Experimental.
	Bind(_scope constructs.Construct) *SourceConfig
}

Represents the source from local assets.

Example:

// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import apprunner_alpha "github.com/aws/aws-cdk-go/awscdkapprunneralpha"
import "github.com/aws/aws-cdk-go/awscdk"

var dockerImageAsset dockerImageAsset
var secret secret

assetSource := apprunner_alpha.NewAssetSource(&AssetProps{
	Asset: dockerImageAsset,

	// the properties below are optional
	ImageConfiguration: &ImageConfiguration{
		Environment: map[string]*string{
			"environmentKey": jsii.String("environment"),
		},
		EnvironmentSecrets: map[string]*secret{
			"environmentSecretsKey": secret,
		},
		EnvironmentVariables: map[string]*string{
			"environmentVariablesKey": jsii.String("environmentVariables"),
		},
		Port: jsii.Number(123),
		StartCommand: jsii.String("startCommand"),
	},
})

Experimental.

func AssetSource_FromAsset

func AssetSource_FromAsset(props *AssetProps) AssetSource

Source from local assets. Experimental.

func EcrPublicSource_FromAsset

func EcrPublicSource_FromAsset(props *AssetProps) AssetSource

Source from local assets. Experimental.

func EcrSource_FromAsset

func EcrSource_FromAsset(props *AssetProps) AssetSource

Source from local assets. Experimental.

func GithubSource_FromAsset

func GithubSource_FromAsset(props *AssetProps) AssetSource

Source from local assets. Experimental.

func NewAssetSource

func NewAssetSource(props *AssetProps) AssetSource

Experimental.

func Source_FromAsset

func Source_FromAsset(props *AssetProps) AssetSource

Source from local assets. Experimental.

type CodeConfiguration

type CodeConfiguration struct {
	// The source of the App Runner configuration.
	// Experimental.
	ConfigurationSource ConfigurationSourceType `field:"required" json:"configurationSource" yaml:"configurationSource"`
	// The basic configuration for building and running the App Runner service.
	//
	// Use it to quickly launch an App Runner service without providing a apprunner.yaml file in the
	// source code repository (or ignoring the file if it exists).
	// Default: - not specified. Use `apprunner.yaml` instead.
	//
	// Experimental.
	ConfigurationValues *CodeConfigurationValues `field:"optional" json:"configurationValues" yaml:"configurationValues"`
}

Describes the configuration that AWS App Runner uses to build and run an App Runner service from a source code repository.

Example:

// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import apprunner_alpha "github.com/aws/aws-cdk-go/awscdkapprunneralpha"

var runtime runtime
var secret secret

codeConfiguration := &CodeConfiguration{
	ConfigurationSource: apprunner_alpha.ConfigurationSourceType_REPOSITORY,

	// the properties below are optional
	ConfigurationValues: &CodeConfigurationValues{
		Runtime: runtime,

		// the properties below are optional
		BuildCommand: jsii.String("buildCommand"),
		Environment: map[string]*string{
			"environmentKey": jsii.String("environment"),
		},
		EnvironmentSecrets: map[string]*secret{
			"environmentSecretsKey": secret,
		},
		EnvironmentVariables: map[string]*string{
			"environmentVariablesKey": jsii.String("environmentVariables"),
		},
		Port: jsii.String("port"),
		StartCommand: jsii.String("startCommand"),
	},
}

See: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apprunner-service-codeconfiguration.html

Experimental.

type CodeConfigurationValues

type CodeConfigurationValues struct {
	// A runtime environment type for building and running an App Runner service.
	//
	// It represents
	// a programming language runtime.
	// Experimental.
	Runtime Runtime `field:"required" json:"runtime" yaml:"runtime"`
	// The command App Runner runs to build your application.
	// Default: - no build command.
	//
	// Experimental.
	BuildCommand *string `field:"optional" json:"buildCommand" yaml:"buildCommand"`
	// The environment variables that are available to your running App Runner service.
	// Default: - no environment variables.
	//
	// Deprecated: use environmentVariables.
	Environment *map[string]*string `field:"optional" json:"environment" yaml:"environment"`
	// The environment secrets that are available to your running App Runner service.
	// Default: - no environment secrets.
	//
	// Experimental.
	EnvironmentSecrets *map[string]Secret `field:"optional" json:"environmentSecrets" yaml:"environmentSecrets"`
	// The environment variables that are available to your running App Runner service.
	// Default: - no environment variables.
	//
	// Experimental.
	EnvironmentVariables *map[string]*string `field:"optional" json:"environmentVariables" yaml:"environmentVariables"`
	// The port that your application listens to in the container.
	// Default: 8080.
	//
	// Experimental.
	Port *string `field:"optional" json:"port" yaml:"port"`
	// The command App Runner runs to start your application.
	// Default: - no start command.
	//
	// Experimental.
	StartCommand *string `field:"optional" json:"startCommand" yaml:"startCommand"`
}

Describes the basic configuration needed for building and running an AWS App Runner service.

This type doesn't support the full set of possible configuration options. Fur full configuration capabilities, use a `apprunner.yaml` file in the source code repository.

Example:

apprunner.NewService(this, jsii.String("Service"), &ServiceProps{
	Source: apprunner.Source_FromGitHub(&GithubRepositoryProps{
		RepositoryUrl: jsii.String("https://github.com/aws-containers/hello-app-runner"),
		Branch: jsii.String("main"),
		ConfigurationSource: apprunner.ConfigurationSourceType_API,
		CodeConfigurationValues: &CodeConfigurationValues{
			Runtime: apprunner.Runtime_PYTHON_3(),
			Port: jsii.String("8000"),
			StartCommand: jsii.String("python app.py"),
			BuildCommand: jsii.String("yum install -y pycairo && pip install -r requirements.txt"),
		},
		Connection: apprunner.GitHubConnection_FromConnectionArn(jsii.String("CONNECTION_ARN")),
	}),
})

Experimental.

type CodeRepositoryProps

type CodeRepositoryProps struct {
	// Configuration for building and running the service from a source code repository.
	// Experimental.
	CodeConfiguration *CodeConfiguration `field:"required" json:"codeConfiguration" yaml:"codeConfiguration"`
	// The App Runner connection for GitHub.
	// Experimental.
	Connection GitHubConnection `field:"required" json:"connection" yaml:"connection"`
	// The location of the repository that contains the source code.
	// Experimental.
	RepositoryUrl *string `field:"required" json:"repositoryUrl" yaml:"repositoryUrl"`
	// The version that should be used within the source code repository.
	// Experimental.
	SourceCodeVersion *SourceCodeVersion `field:"required" json:"sourceCodeVersion" yaml:"sourceCodeVersion"`
}

Properties of the CodeRepository.

Example:

// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import apprunner_alpha "github.com/aws/aws-cdk-go/awscdkapprunneralpha"

var gitHubConnection gitHubConnection
var runtime runtime
var secret secret

codeRepositoryProps := &CodeRepositoryProps{
	CodeConfiguration: &CodeConfiguration{
		ConfigurationSource: apprunner_alpha.ConfigurationSourceType_REPOSITORY,

		// the properties below are optional
		ConfigurationValues: &CodeConfigurationValues{
			Runtime: runtime,

			// the properties below are optional
			BuildCommand: jsii.String("buildCommand"),
			Environment: map[string]*string{
				"environmentKey": jsii.String("environment"),
			},
			EnvironmentSecrets: map[string]*secret{
				"environmentSecretsKey": secret,
			},
			EnvironmentVariables: map[string]*string{
				"environmentVariablesKey": jsii.String("environmentVariables"),
			},
			Port: jsii.String("port"),
			StartCommand: jsii.String("startCommand"),
		},
	},
	Connection: gitHubConnection,
	RepositoryUrl: jsii.String("repositoryUrl"),
	SourceCodeVersion: &SourceCodeVersion{
		Type: jsii.String("type"),
		Value: jsii.String("value"),
	},
}

Experimental.

type ConfigurationSourceType

type ConfigurationSourceType string

The source of the App Runner configuration.

Example:

apprunner.NewService(this, jsii.String("Service"), &ServiceProps{
	Source: apprunner.Source_FromGitHub(&GithubRepositoryProps{
		RepositoryUrl: jsii.String("https://github.com/aws-containers/hello-app-runner"),
		Branch: jsii.String("main"),
		ConfigurationSource: apprunner.ConfigurationSourceType_REPOSITORY,
		Connection: apprunner.GitHubConnection_FromConnectionArn(jsii.String("CONNECTION_ARN")),
	}),
})

Experimental.

const (
	// App Runner reads configuration values from `the apprunner.yaml` file in the source code repository and ignores `configurationValues`.
	// Experimental.
	ConfigurationSourceType_REPOSITORY ConfigurationSourceType = "REPOSITORY"
	// App Runner uses configuration values provided in `configurationValues` and ignores the `apprunner.yaml` file in the source code repository.
	// Experimental.
	ConfigurationSourceType_API ConfigurationSourceType = "API"
)

type Cpu

type Cpu interface {
	// The unit of CPU.
	// Experimental.
	Unit() *string
}

The number of CPU units reserved for each instance of your App Runner service.

Example:

// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import apprunner_alpha "github.com/aws/aws-cdk-go/awscdkapprunneralpha"

cpu := apprunner_alpha.Cpu_FOUR_VCPU()

Experimental.

func Cpu_FOUR_VCPU

func Cpu_FOUR_VCPU() Cpu

func Cpu_HALF_VCPU

func Cpu_HALF_VCPU() Cpu

func Cpu_ONE_VCPU

func Cpu_ONE_VCPU() Cpu

func Cpu_QUARTER_VCPU

func Cpu_QUARTER_VCPU() Cpu

func Cpu_TWO_VCPU

func Cpu_TWO_VCPU() Cpu

type EcrProps

type EcrProps struct {
	// Represents the ECR repository.
	// Experimental.
	Repository awsecr.IRepository `field:"required" json:"repository" yaml:"repository"`
	// The image configuration for the image from ECR.
	// See: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apprunner-service-imageconfiguration.html#cfn-apprunner-service-imageconfiguration-port
	//
	// Default: - no image configuration will be passed. The default `port` will be 8080.
	//
	// Experimental.
	ImageConfiguration *ImageConfiguration `field:"optional" json:"imageConfiguration" yaml:"imageConfiguration"`
	// Image tag.
	// Default: - 'latest'.
	//
	// Deprecated: use `tagOrDigest`.
	Tag *string `field:"optional" json:"tag" yaml:"tag"`
	// Image tag or digest (digests must start with `sha256:`).
	// Default: - 'latest'.
	//
	// Experimental.
	TagOrDigest *string `field:"optional" json:"tagOrDigest" yaml:"tagOrDigest"`
}

Properties of the image repository for `Source.fromEcr()`.

Example:

import ecr "github.com/aws/aws-cdk-go/awscdk"

apprunner.NewService(this, jsii.String("Service"), &ServiceProps{
	Source: apprunner.Source_FromEcr(&EcrProps{
		ImageConfiguration: &ImageConfiguration{
			Port: jsii.Number(80),
		},
		Repository: ecr.Repository_FromRepositoryName(this, jsii.String("NginxRepository"), jsii.String("nginx")),
		TagOrDigest: jsii.String("latest"),
	}),
})

Experimental.

type EcrPublicProps

type EcrPublicProps struct {
	// The ECR Public image URI.
	// Experimental.
	ImageIdentifier *string `field:"required" json:"imageIdentifier" yaml:"imageIdentifier"`
	// The image configuration for the image from ECR Public.
	// See: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apprunner-service-imageconfiguration.html#cfn-apprunner-service-imageconfiguration-port
	//
	// Default: - no image configuration will be passed. The default `port` will be 8080.
	//
	// Experimental.
	ImageConfiguration *ImageConfiguration `field:"optional" json:"imageConfiguration" yaml:"imageConfiguration"`
}

Properties of the image repository for `Source.fromEcrPublic()`.

Example:

import "github.com/aws/aws-cdk-go/awscdk"

vpc := ec2.NewVpc(this, jsii.String("Vpc"), &VpcProps{
	IpAddresses: ec2.IpAddresses_Cidr(jsii.String("10.0.0.0/16")),
})

vpcConnector := apprunner.NewVpcConnector(this, jsii.String("VpcConnector"), &VpcConnectorProps{
	Vpc: Vpc,
	VpcSubnets: vpc.selectSubnets(&SubnetSelection{
		SubnetType: ec2.SubnetType_PUBLIC,
	}),
	VpcConnectorName: jsii.String("MyVpcConnector"),
})

apprunner.NewService(this, jsii.String("Service"), &ServiceProps{
	Source: apprunner.Source_FromEcrPublic(&EcrPublicProps{
		ImageConfiguration: &ImageConfiguration{
			Port: jsii.Number(8000),
		},
		ImageIdentifier: jsii.String("public.ecr.aws/aws-containers/hello-app-runner:latest"),
	}),
	VpcConnector: VpcConnector,
})

Experimental.

type EcrPublicSource

type EcrPublicSource interface {
	Source
	// Called when the Job is initialized to allow this object to bind.
	// Experimental.
	Bind(_scope constructs.Construct) *SourceConfig
}

Represents the service source from ECR Public.

Example:

// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import apprunner_alpha "github.com/aws/aws-cdk-go/awscdkapprunneralpha"

var secret secret

ecrPublicSource := apprunner_alpha.NewEcrPublicSource(&EcrPublicProps{
	ImageIdentifier: jsii.String("imageIdentifier"),

	// the properties below are optional
	ImageConfiguration: &ImageConfiguration{
		Environment: map[string]*string{
			"environmentKey": jsii.String("environment"),
		},
		EnvironmentSecrets: map[string]*secret{
			"environmentSecretsKey": secret,
		},
		EnvironmentVariables: map[string]*string{
			"environmentVariablesKey": jsii.String("environmentVariables"),
		},
		Port: jsii.Number(123),
		StartCommand: jsii.String("startCommand"),
	},
})

Experimental.

func AssetSource_FromEcrPublic

func AssetSource_FromEcrPublic(props *EcrPublicProps) EcrPublicSource

Source from the ECR Public repository. Experimental.

func EcrPublicSource_FromEcrPublic

func EcrPublicSource_FromEcrPublic(props *EcrPublicProps) EcrPublicSource

Source from the ECR Public repository. Experimental.

func EcrSource_FromEcrPublic

func EcrSource_FromEcrPublic(props *EcrPublicProps) EcrPublicSource

Source from the ECR Public repository. Experimental.

func GithubSource_FromEcrPublic

func GithubSource_FromEcrPublic(props *EcrPublicProps) EcrPublicSource

Source from the ECR Public repository. Experimental.

func NewEcrPublicSource

func NewEcrPublicSource(props *EcrPublicProps) EcrPublicSource

Experimental.

func Source_FromEcrPublic

func Source_FromEcrPublic(props *EcrPublicProps) EcrPublicSource

Source from the ECR Public repository. Experimental.

type EcrSource

type EcrSource interface {
	Source
	// Called when the Job is initialized to allow this object to bind.
	// Experimental.
	Bind(_scope constructs.Construct) *SourceConfig
}

Represents the service source from ECR.

Example:

// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import apprunner_alpha "github.com/aws/aws-cdk-go/awscdkapprunneralpha"
import "github.com/aws/aws-cdk-go/awscdk"

var repository repository
var secret secret

ecrSource := apprunner_alpha.NewEcrSource(&EcrProps{
	Repository: repository,

	// the properties below are optional
	ImageConfiguration: &ImageConfiguration{
		Environment: map[string]*string{
			"environmentKey": jsii.String("environment"),
		},
		EnvironmentSecrets: map[string]*secret{
			"environmentSecretsKey": secret,
		},
		EnvironmentVariables: map[string]*string{
			"environmentVariablesKey": jsii.String("environmentVariables"),
		},
		Port: jsii.Number(123),
		StartCommand: jsii.String("startCommand"),
	},
	Tag: jsii.String("tag"),
	TagOrDigest: jsii.String("tagOrDigest"),
})

Experimental.

func AssetSource_FromEcr

func AssetSource_FromEcr(props *EcrProps) EcrSource

Source from the ECR repository. Experimental.

func EcrPublicSource_FromEcr

func EcrPublicSource_FromEcr(props *EcrProps) EcrSource

Source from the ECR repository. Experimental.

func EcrSource_FromEcr

func EcrSource_FromEcr(props *EcrProps) EcrSource

Source from the ECR repository. Experimental.

func GithubSource_FromEcr

func GithubSource_FromEcr(props *EcrProps) EcrSource

Source from the ECR repository. Experimental.

func NewEcrSource

func NewEcrSource(props *EcrProps) EcrSource

Experimental.

func Source_FromEcr

func Source_FromEcr(props *EcrProps) EcrSource

Source from the ECR repository. Experimental.

type GitHubConnection

type GitHubConnection interface {
	// The ARN of the Connection for App Runner service to connect to the repository.
	// Experimental.
	ConnectionArn() *string
}

Represents the App Runner connection that enables the App Runner service to connect to a source repository.

It's required for GitHub code repositories.

Example:

apprunner.NewService(this, jsii.String("Service"), &ServiceProps{
	Source: apprunner.Source_FromGitHub(&GithubRepositoryProps{
		RepositoryUrl: jsii.String("https://github.com/aws-containers/hello-app-runner"),
		Branch: jsii.String("main"),
		ConfigurationSource: apprunner.ConfigurationSourceType_REPOSITORY,
		Connection: apprunner.GitHubConnection_FromConnectionArn(jsii.String("CONNECTION_ARN")),
	}),
})

Experimental.

func GitHubConnection_FromConnectionArn

func GitHubConnection_FromConnectionArn(arn *string) GitHubConnection

Using existing App Runner connection by specifying the connection ARN.

Returns: Connection. Experimental.

func NewGitHubConnection

func NewGitHubConnection(arn *string) GitHubConnection

Experimental.

type GithubRepositoryProps

type GithubRepositoryProps struct {
	// The source of the App Runner configuration.
	// Experimental.
	ConfigurationSource ConfigurationSourceType `field:"required" json:"configurationSource" yaml:"configurationSource"`
	// ARN of the connection to Github.
	//
	// Only required for Github source.
	// Experimental.
	Connection GitHubConnection `field:"required" json:"connection" yaml:"connection"`
	// The location of the repository that contains the source code.
	// Experimental.
	RepositoryUrl *string `field:"required" json:"repositoryUrl" yaml:"repositoryUrl"`
	// The branch name that represents a specific version for the repository.
	// Default: main.
	//
	// Experimental.
	Branch *string `field:"optional" json:"branch" yaml:"branch"`
	// The code configuration values.
	//
	// Will be ignored if configurationSource is `REPOSITORY`.
	// Default: - no values will be passed. The `apprunner.yaml` from the github reopsitory will be used instead.
	//
	// Experimental.
	CodeConfigurationValues *CodeConfigurationValues `field:"optional" json:"codeConfigurationValues" yaml:"codeConfigurationValues"`
}

Properties of the Github repository for `Source.fromGitHub()`.

Example:

apprunner.NewService(this, jsii.String("Service"), &ServiceProps{
	Source: apprunner.Source_FromGitHub(&GithubRepositoryProps{
		RepositoryUrl: jsii.String("https://github.com/aws-containers/hello-app-runner"),
		Branch: jsii.String("main"),
		ConfigurationSource: apprunner.ConfigurationSourceType_REPOSITORY,
		Connection: apprunner.GitHubConnection_FromConnectionArn(jsii.String("CONNECTION_ARN")),
	}),
})

Experimental.

type GithubSource

type GithubSource interface {
	Source
	// Called when the Job is initialized to allow this object to bind.
	// Experimental.
	Bind(_scope constructs.Construct) *SourceConfig
}

Represents the service source from a Github repository.

Example:

// 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/awscdkapprunneralpha"

var gitHubConnection gitHubConnection
var runtime runtime
var secret secret

githubSource := apprunner_alpha.NewGithubSource(&GithubRepositoryProps{
	ConfigurationSource: apprunner_alpha.ConfigurationSourceType_REPOSITORY,
	Connection: gitHubConnection,
	RepositoryUrl: jsii.String("repositoryUrl"),

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

		// the properties below are optional
		BuildCommand: jsii.String("buildCommand"),
		Environment: map[string]*string{
			"environmentKey": jsii.String("environment"),
		},
		EnvironmentSecrets: map[string]*secret{
			"environmentSecretsKey": secret,
		},
		EnvironmentVariables: map[string]*string{
			"environmentVariablesKey": jsii.String("environmentVariables"),
		},
		Port: jsii.String("port"),
		StartCommand: jsii.String("startCommand"),
	},
})

Experimental.

func AssetSource_FromGitHub

func AssetSource_FromGitHub(props *GithubRepositoryProps) GithubSource

Source from the GitHub repository. Experimental.

func EcrPublicSource_FromGitHub

func EcrPublicSource_FromGitHub(props *GithubRepositoryProps) GithubSource

Source from the GitHub repository. Experimental.

func EcrSource_FromGitHub

func EcrSource_FromGitHub(props *GithubRepositoryProps) GithubSource

Source from the GitHub repository. Experimental.

func GithubSource_FromGitHub

func GithubSource_FromGitHub(props *GithubRepositoryProps) GithubSource

Source from the GitHub repository. Experimental.

func NewGithubSource

func NewGithubSource(props *GithubRepositoryProps) GithubSource

Experimental.

func Source_FromGitHub

func Source_FromGitHub(props *GithubRepositoryProps) GithubSource

Source from the GitHub repository. Experimental.

type IService

type IService interface {
	awscdk.IResource
	// The ARN of the service.
	// Experimental.
	ServiceArn() *string
	// The Name of the service.
	// Experimental.
	ServiceName() *string
}

Represents the App Runner Service. Experimental.

func Service_FromServiceAttributes

func Service_FromServiceAttributes(scope constructs.Construct, id *string, attrs *ServiceAttributes) IService

Import from service attributes. Experimental.

func Service_FromServiceName

func Service_FromServiceName(scope constructs.Construct, id *string, serviceName *string) IService

Import from service name. Experimental.

type IVpcConnector

type IVpcConnector interface {
	awsec2.IConnectable
	awscdk.IResource
	// The ARN of the VPC connector.
	// Experimental.
	VpcConnectorArn() *string
	// The Name of the VPC connector.
	// Experimental.
	VpcConnectorName() *string
	// The revision of the VPC connector.
	// Experimental.
	VpcConnectorRevision() *float64
}

Represents the App Runner VPC Connector. Experimental.

func VpcConnector_FromVpcConnectorAttributes

func VpcConnector_FromVpcConnectorAttributes(scope constructs.Construct, id *string, attrs *VpcConnectorAttributes) IVpcConnector

Import from VPC connector attributes. Experimental.

type ImageConfiguration

type ImageConfiguration struct {
	// Environment variables that are available to your running App Runner service.
	// Default: - no environment variables.
	//
	// Deprecated: use environmentVariables.
	Environment *map[string]*string `field:"optional" json:"environment" yaml:"environment"`
	// Environment secrets that are available to your running App Runner service.
	// Default: - no environment secrets.
	//
	// Experimental.
	EnvironmentSecrets *map[string]Secret `field:"optional" json:"environmentSecrets" yaml:"environmentSecrets"`
	// Environment variables that are available to your running App Runner service.
	// Default: - no environment variables.
	//
	// Experimental.
	EnvironmentVariables *map[string]*string `field:"optional" json:"environmentVariables" yaml:"environmentVariables"`
	// The port that your application listens to in the container.
	// Default: 8080.
	//
	// Experimental.
	Port *float64 `field:"optional" json:"port" yaml:"port"`
	// An optional command that App Runner runs to start the application in the source image.
	//
	// If specified, this command overrides the Docker image’s default start command.
	// Default: - no start command.
	//
	// Experimental.
	StartCommand *string `field:"optional" json:"startCommand" yaml:"startCommand"`
}

Describes the configuration that AWS App Runner uses to run an App Runner service using an image pulled from a source image repository.

Example:

import "github.com/aws/aws-cdk-go/awscdk"

service := apprunner.NewService(this, jsii.String("Service"), &ServiceProps{
	Source: apprunner.Source_FromEcrPublic(&EcrPublicProps{
		ImageConfiguration: &ImageConfiguration{
			Port: jsii.Number(8000),
		},
		ImageIdentifier: jsii.String("public.ecr.aws/aws-containers/hello-app-runner:latest"),
	}),
})

service.AddToRolePolicy(iam.NewPolicyStatement(&PolicyStatementProps{
	Effect: iam.Effect_ALLOW,
	Actions: []*string{
		jsii.String("s3:GetObject"),
	},
	Resources: []*string{
		jsii.String("*"),
	},
}))

See: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apprunner-service-imageconfiguration.html

Experimental.

type ImageRepository

type ImageRepository struct {
	// The identifier of the image.
	//
	// For `ECR_PUBLIC` imageRepositoryType, the identifier domain should
	// always be `public.ecr.aws`. For `ECR`, the pattern should be
	// `([0-9]{12}.dkr.ecr.[a-z\-]+-[0-9]{1}.amazonaws.com\/.*)`.
	// See: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apprunner-service-imagerepository.html for more details.
	//
	// Experimental.
	ImageIdentifier *string `field:"required" json:"imageIdentifier" yaml:"imageIdentifier"`
	// The type of the image repository.
	//
	// This reflects the repository provider and whether
	// the repository is private or public.
	// Experimental.
	ImageRepositoryType ImageRepositoryType `field:"required" json:"imageRepositoryType" yaml:"imageRepositoryType"`
	// Configuration for running the identified image.
	// See: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apprunner-service-imageconfiguration.html#cfn-apprunner-service-imageconfiguration-port
	//
	// Default: - no image configuration will be passed. The default `port` will be 8080.
	//
	// Experimental.
	ImageConfiguration *ImageConfiguration `field:"optional" json:"imageConfiguration" yaml:"imageConfiguration"`
}

Describes a source image repository.

Example:

// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import apprunner_alpha "github.com/aws/aws-cdk-go/awscdkapprunneralpha"

var secret secret

imageRepository := &ImageRepository{
	ImageIdentifier: jsii.String("imageIdentifier"),
	ImageRepositoryType: apprunner_alpha.ImageRepositoryType_ECR_PUBLIC,

	// the properties below are optional
	ImageConfiguration: &ImageConfiguration{
		Environment: map[string]*string{
			"environmentKey": jsii.String("environment"),
		},
		EnvironmentSecrets: map[string]*secret{
			"environmentSecretsKey": secret,
		},
		EnvironmentVariables: map[string]*string{
			"environmentVariablesKey": jsii.String("environmentVariables"),
		},
		Port: jsii.Number(123),
		StartCommand: jsii.String("startCommand"),
	},
}

See: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apprunner-service-imagerepository.html

Experimental.

type ImageRepositoryType

type ImageRepositoryType string

The image repository types. Experimental.

const (
	// Amazon ECR Public.
	// Experimental.
	ImageRepositoryType_ECR_PUBLIC ImageRepositoryType = "ECR_PUBLIC"
	// Amazon ECR.
	// Experimental.
	ImageRepositoryType_ECR ImageRepositoryType = "ECR"
)

type Memory

type Memory interface {
	// The unit of memory.
	// Experimental.
	Unit() *string
}

The amount of memory reserved for each instance of your App Runner service.

Example:

// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import apprunner_alpha "github.com/aws/aws-cdk-go/awscdkapprunneralpha"

memory := apprunner_alpha.Memory_EIGHT_GB()

Experimental.

func Memory_EIGHT_GB

func Memory_EIGHT_GB() Memory

func Memory_FOUR_GB

func Memory_FOUR_GB() Memory

func Memory_HALF_GB

func Memory_HALF_GB() Memory

func Memory_ONE_GB

func Memory_ONE_GB() Memory

func Memory_SIX_GB

func Memory_SIX_GB() Memory

func Memory_TEN_GB

func Memory_TEN_GB() Memory

func Memory_THREE_GB

func Memory_THREE_GB() Memory

func Memory_TWELVE_GB

func Memory_TWELVE_GB() Memory

func Memory_TWO_GB

func Memory_TWO_GB() Memory

type Runtime

type Runtime interface {
	// The runtime name.
	// Experimental.
	Name() *string
}

The code runtimes.

Example:

apprunner.NewService(this, jsii.String("Service"), &ServiceProps{
	Source: apprunner.Source_FromGitHub(&GithubRepositoryProps{
		RepositoryUrl: jsii.String("https://github.com/aws-containers/hello-app-runner"),
		Branch: jsii.String("main"),
		ConfigurationSource: apprunner.ConfigurationSourceType_API,
		CodeConfigurationValues: &CodeConfigurationValues{
			Runtime: apprunner.Runtime_PYTHON_3(),
			Port: jsii.String("8000"),
			StartCommand: jsii.String("python app.py"),
			BuildCommand: jsii.String("yum install -y pycairo && pip install -r requirements.txt"),
		},
		Connection: apprunner.GitHubConnection_FromConnectionArn(jsii.String("CONNECTION_ARN")),
	}),
})

Experimental.

func Runtime_CORRETTO_11

func Runtime_CORRETTO_11() Runtime

func Runtime_CORRETTO_8

func Runtime_CORRETTO_8() Runtime

func Runtime_DOTNET_6

func Runtime_DOTNET_6() Runtime

func Runtime_GO_1

func Runtime_GO_1() Runtime

func Runtime_NODEJS_12

func Runtime_NODEJS_12() Runtime

func Runtime_NODEJS_14

func Runtime_NODEJS_14() Runtime

func Runtime_NODEJS_16

func Runtime_NODEJS_16() Runtime

func Runtime_PHP_81

func Runtime_PHP_81() Runtime

func Runtime_PYTHON_3

func Runtime_PYTHON_3() Runtime

func Runtime_RUBY_31

func Runtime_RUBY_31() Runtime

type Secret

type Secret interface {
	// The ARN of the secret.
	// Experimental.
	Arn() *string
	// Whether this secret uses a specific JSON field.
	// Experimental.
	HasField() *bool
	// Grants reading the secret to a principal.
	// Experimental.
	GrantRead(grantee awsiam.IGrantable) awsiam.Grant
}

A secret environment variable.

Example:

import secretsmanager "github.com/aws/aws-cdk-go/awscdk"
import ssm "github.com/aws/aws-cdk-go/awscdk"

var stack stack

secret := secretsmanager.NewSecret(stack, jsii.String("Secret"))
parameter := ssm.StringParameter_FromSecureStringParameterAttributes(stack, jsii.String("Parameter"), &SecureStringParameterAttributes{
	ParameterName: jsii.String("/name"),
	Version: jsii.Number(1),
})

service := apprunner.NewService(stack, jsii.String("Service"), &ServiceProps{
	Source: apprunner.Source_FromEcrPublic(&EcrPublicProps{
		ImageConfiguration: &ImageConfiguration{
			Port: jsii.Number(8000),
			EnvironmentSecrets: map[string]secret{
				"SECRET": apprunner.*secret_fromSecretsManager(secret),
				"PARAMETER": apprunner.*secret_fromSsmParameter(parameter),
				"SECRET_ID": apprunner.*secret_fromSecretsManagerVersion(secret, &SecretVersionInfo{
					"versionId": jsii.String("version-id"),
				}),
				"SECRET_STAGE": apprunner.*secret_fromSecretsManagerVersion(secret, &SecretVersionInfo{
					"versionStage": jsii.String("version-stage"),
				}),
			},
		},
		ImageIdentifier: jsii.String("public.ecr.aws/aws-containers/hello-app-runner:latest"),
	}),
})

service.AddSecret(jsii.String("LATER_SECRET"), apprunner.secret_FromSecretsManager(secret, jsii.String("field")))

Experimental.

func Secret_FromSecretsManager

func Secret_FromSecretsManager(secret awssecretsmanager.ISecret, field *string) Secret

Creates a environment variable value from a secret stored in AWS Secrets Manager. Experimental.

func Secret_FromSecretsManagerVersion

func Secret_FromSecretsManagerVersion(secret awssecretsmanager.ISecret, versionInfo *SecretVersionInfo, field *string) Secret

Creates a environment variable value from a secret stored in AWS Secrets Manager. Experimental.

func Secret_FromSsmParameter

func Secret_FromSsmParameter(parameter awsssm.IParameter) Secret

Creates an environment variable value from a parameter stored in AWS Systems Manager Parameter Store. Experimental.

type SecretVersionInfo

type SecretVersionInfo struct {
	// version id of the secret.
	// Default: - use default version id.
	//
	// Experimental.
	VersionId *string `field:"optional" json:"versionId" yaml:"versionId"`
	// version stage of the secret.
	// Default: - use default version stage.
	//
	// Experimental.
	VersionStage *string `field:"optional" json:"versionStage" yaml:"versionStage"`
}

Specify the secret's version id or version stage.

Example:

import secretsmanager "github.com/aws/aws-cdk-go/awscdk"
import ssm "github.com/aws/aws-cdk-go/awscdk"

var stack stack

secret := secretsmanager.NewSecret(stack, jsii.String("Secret"))
parameter := ssm.StringParameter_FromSecureStringParameterAttributes(stack, jsii.String("Parameter"), &SecureStringParameterAttributes{
	ParameterName: jsii.String("/name"),
	Version: jsii.Number(1),
})

service := apprunner.NewService(stack, jsii.String("Service"), &ServiceProps{
	Source: apprunner.Source_FromEcrPublic(&EcrPublicProps{
		ImageConfiguration: &ImageConfiguration{
			Port: jsii.Number(8000),
			EnvironmentSecrets: map[string]secret{
				"SECRET": apprunner.*secret_fromSecretsManager(secret),
				"PARAMETER": apprunner.*secret_fromSsmParameter(parameter),
				"SECRET_ID": apprunner.*secret_fromSecretsManagerVersion(secret, &SecretVersionInfo{
					"versionId": jsii.String("version-id"),
				}),
				"SECRET_STAGE": apprunner.*secret_fromSecretsManagerVersion(secret, &SecretVersionInfo{
					"versionStage": jsii.String("version-stage"),
				}),
			},
		},
		ImageIdentifier: jsii.String("public.ecr.aws/aws-containers/hello-app-runner:latest"),
	}),
})

service.AddSecret(jsii.String("LATER_SECRET"), apprunner.secret_FromSecretsManager(secret, jsii.String("field")))

Experimental.

type Service

type Service interface {
	awscdk.Resource
	awsiam.IGrantable
	// The environment this resource belongs to.
	//
	// For resources that are created and managed by the CDK
	// (generally, those created by creating new class instances like Role, Bucket, etc.),
	// this is always the same as the environment of the stack they belong to;
	// however, for imported resources
	// (those obtained from static methods like fromRoleArn, fromBucketName, etc.),
	// that might be different than the stack they were imported into.
	// Experimental.
	Env() *awscdk.ResourceEnvironment
	// Environment variables for this service.
	// Deprecated: use environmentVariables.
	Environment() *map[string]*string
	// The principal to grant permissions to.
	// Experimental.
	GrantPrincipal() awsiam.IPrincipal
	// The tree node.
	// Experimental.
	Node() constructs.Node
	// Returns a string-encoded token that resolves to the physical name that should be passed to the CloudFormation resource.
	//
	// This value will resolve to one of the following:
	// - a concrete value (e.g. `"my-awesome-bucket"`)
	// - `undefined`, when a name should be generated by CloudFormation
	// - a concrete name generated automatically during synthesis, in
	//   cross-environment scenarios.
	// Experimental.
	PhysicalName() *string
	// The ARN of the Service.
	// Experimental.
	ServiceArn() *string
	// The ID of the Service.
	// Experimental.
	ServiceId() *string
	// The name of the service.
	// Experimental.
	ServiceName() *string
	// The status of the Service.
	// Experimental.
	ServiceStatus() *string
	// The URL of the Service.
	// Experimental.
	ServiceUrl() *string
	// The stack in which this resource is defined.
	// Experimental.
	Stack() awscdk.Stack
	// This method adds an environment variable to the App Runner service.
	// Experimental.
	AddEnvironmentVariable(name *string, value *string)
	// This method adds a secret as environment variable to the App Runner service.
	// Experimental.
	AddSecret(name *string, secret Secret)
	// Adds a statement to the instance role.
	// Experimental.
	AddToRolePolicy(statement awsiam.PolicyStatement)
	// Apply the given removal policy to this resource.
	//
	// The Removal Policy controls what happens to this resource when it stops
	// being managed by CloudFormation, either because you've removed it from the
	// CDK application or because you've made a change that requires the resource
	// to be replaced.
	//
	// The resource can be deleted (`RemovalPolicy.DESTROY`), or left in your AWS
	// account for data recovery and cleanup later (`RemovalPolicy.RETAIN`).
	// Experimental.
	ApplyRemovalPolicy(policy awscdk.RemovalPolicy)
	// Experimental.
	GeneratePhysicalName() *string
	// Returns an environment-sensitive token that should be used for the resource's "ARN" attribute (e.g. `bucket.bucketArn`).
	//
	// Normally, this token will resolve to `arnAttr`, but if the resource is
	// referenced across environments, `arnComponents` will be used to synthesize
	// a concrete ARN with the resource's physical name. Make sure to reference
	// `this.physicalName` in `arnComponents`.
	// Experimental.
	GetResourceArnAttribute(arnAttr *string, arnComponents *awscdk.ArnComponents) *string
	// Returns an environment-sensitive token that should be used for the resource's "name" attribute (e.g. `bucket.bucketName`).
	//
	// Normally, this token will resolve to `nameAttr`, but if the resource is
	// referenced across environments, it will be resolved to `this.physicalName`,
	// which will be a concrete name.
	// Experimental.
	GetResourceNameAttribute(nameAttr *string) *string
	// Returns a string representation of this construct.
	// Experimental.
	ToString() *string
}

The App Runner Service.

Example:

import "github.com/aws/aws-cdk-go/awscdk"

service := apprunner.NewService(this, jsii.String("Service"), &ServiceProps{
	Source: apprunner.Source_FromEcrPublic(&EcrPublicProps{
		ImageConfiguration: &ImageConfiguration{
			Port: jsii.Number(8000),
		},
		ImageIdentifier: jsii.String("public.ecr.aws/aws-containers/hello-app-runner:latest"),
	}),
})

service.AddToRolePolicy(iam.NewPolicyStatement(&PolicyStatementProps{
	Effect: iam.Effect_ALLOW,
	Actions: []*string{
		jsii.String("s3:GetObject"),
	},
	Resources: []*string{
		jsii.String("*"),
	},
}))

Experimental.

func NewService

func NewService(scope constructs.Construct, id *string, props *ServiceProps) Service

Experimental.

type ServiceAttributes

type ServiceAttributes struct {
	// The ARN of the service.
	// Experimental.
	ServiceArn *string `field:"required" json:"serviceArn" yaml:"serviceArn"`
	// The name of the service.
	// Experimental.
	ServiceName *string `field:"required" json:"serviceName" yaml:"serviceName"`
	// The status of the service.
	// Experimental.
	ServiceStatus *string `field:"required" json:"serviceStatus" yaml:"serviceStatus"`
	// The URL of the service.
	// Experimental.
	ServiceUrl *string `field:"required" json:"serviceUrl" yaml:"serviceUrl"`
}

Attributes for the App Runner Service.

Example:

// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import apprunner_alpha "github.com/aws/aws-cdk-go/awscdkapprunneralpha"

serviceAttributes := &ServiceAttributes{
	ServiceArn: jsii.String("serviceArn"),
	ServiceName: jsii.String("serviceName"),
	ServiceStatus: jsii.String("serviceStatus"),
	ServiceUrl: jsii.String("serviceUrl"),
}

Experimental.

type ServiceProps

type ServiceProps struct {
	// The source of the repository for the service.
	// Experimental.
	Source Source `field:"required" json:"source" yaml:"source"`
	// 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.
	// See: https://docs.aws.amazon.com/apprunner/latest/dg/security_iam_service-with-iam.html#security_iam_service-with-iam-roles-service.access
	//
	// Default: - generate a new access role.
	//
	// Experimental.
	AccessRole awsiam.IRole `field:"optional" json:"accessRole" yaml:"accessRole"`
	// Specifies whether to enable continuous integration from the source repository.
	//
	// 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).
	// Default: - no value will be passed.
	//
	// Experimental.
	AutoDeploymentsEnabled *bool `field:"optional" json:"autoDeploymentsEnabled" yaml:"autoDeploymentsEnabled"`
	// The number of CPU units reserved for each instance of your App Runner service.
	// Default: Cpu.ONE_VCPU
	//
	// Experimental.
	Cpu Cpu `field:"optional" json:"cpu" yaml:"cpu"`
	// 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.
	// See: https://docs.aws.amazon.com/apprunner/latest/dg/security_iam_service-with-iam.html#security_iam_service-with-iam-roles-service.instance
	//
	// Default: - generate a new instance role.
	//
	// Experimental.
	InstanceRole awsiam.IRole `field:"optional" json:"instanceRole" yaml:"instanceRole"`
	// The amount of memory reserved for each instance of your App Runner service.
	// Default: Memory.TWO_GB
	//
	// Experimental.
	Memory Memory `field:"optional" json:"memory" yaml:"memory"`
	// Name of the service.
	// Default: - auto-generated if undefined.
	//
	// Experimental.
	ServiceName *string `field:"optional" json:"serviceName" yaml:"serviceName"`
	// Settings for an App Runner VPC connector to associate with the service.
	// Default: - no VPC connector, uses the DEFAULT egress type instead.
	//
	// Experimental.
	VpcConnector IVpcConnector `field:"optional" json:"vpcConnector" yaml:"vpcConnector"`
}

Properties of the AppRunner Service.

Example:

import "github.com/aws/aws-cdk-go/awscdk"

service := apprunner.NewService(this, jsii.String("Service"), &ServiceProps{
	Source: apprunner.Source_FromEcrPublic(&EcrPublicProps{
		ImageConfiguration: &ImageConfiguration{
			Port: jsii.Number(8000),
		},
		ImageIdentifier: jsii.String("public.ecr.aws/aws-containers/hello-app-runner:latest"),
	}),
})

service.AddToRolePolicy(iam.NewPolicyStatement(&PolicyStatementProps{
	Effect: iam.Effect_ALLOW,
	Actions: []*string{
		jsii.String("s3:GetObject"),
	},
	Resources: []*string{
		jsii.String("*"),
	},
}))

Experimental.

type Source

type Source interface {
	// Called when the Job is initialized to allow this object to bind.
	// Experimental.
	Bind(scope constructs.Construct) *SourceConfig
}

Represents the App Runner service source.

Example:

import "github.com/aws/aws-cdk-go/awscdk"

service := apprunner.NewService(this, jsii.String("Service"), &ServiceProps{
	Source: apprunner.Source_FromEcrPublic(&EcrPublicProps{
		ImageConfiguration: &ImageConfiguration{
			Port: jsii.Number(8000),
		},
		ImageIdentifier: jsii.String("public.ecr.aws/aws-containers/hello-app-runner:latest"),
	}),
})

service.AddToRolePolicy(iam.NewPolicyStatement(&PolicyStatementProps{
	Effect: iam.Effect_ALLOW,
	Actions: []*string{
		jsii.String("s3:GetObject"),
	},
	Resources: []*string{
		jsii.String("*"),
	},
}))

Experimental.

type SourceCodeVersion

type SourceCodeVersion struct {
	// The type of version identifier.
	// Experimental.
	Type *string `field:"required" json:"type" yaml:"type"`
	// A source code version.
	// Experimental.
	Value *string `field:"required" json:"value" yaml:"value"`
}

Identifies a version of code that AWS App Runner refers to within a source code repository.

Example:

// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import apprunner_alpha "github.com/aws/aws-cdk-go/awscdkapprunneralpha"

sourceCodeVersion := &SourceCodeVersion{
	Type: jsii.String("type"),
	Value: jsii.String("value"),
}

See: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apprunner-service-sourcecodeversion.html

Experimental.

type SourceConfig

type SourceConfig struct {
	// The code repository configuration (mutually exclusive  with `imageRepository`).
	// Default: - no code repository.
	//
	// Experimental.
	CodeRepository *CodeRepositoryProps `field:"optional" json:"codeRepository" yaml:"codeRepository"`
	// The ECR repository (required to grant the pull privileges for the iam role).
	// Default: - no ECR repository.
	//
	// Experimental.
	EcrRepository awsecr.IRepository `field:"optional" json:"ecrRepository" yaml:"ecrRepository"`
	// The image repository configuration (mutually exclusive  with `codeRepository`).
	// Default: - no image repository.
	//
	// Experimental.
	ImageRepository *ImageRepository `field:"optional" json:"imageRepository" yaml:"imageRepository"`
}

Result of binding `Source` into a `Service`.

Example:

// 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/awscdkapprunneralpha"
import "github.com/aws/aws-cdk-go/awscdk"

var gitHubConnection gitHubConnection
var repository repository
var runtime runtime
var secret secret

sourceConfig := &SourceConfig{
	CodeRepository: &CodeRepositoryProps{
		CodeConfiguration: &CodeConfiguration{
			ConfigurationSource: apprunner_alpha.ConfigurationSourceType_REPOSITORY,

			// the properties below are optional
			ConfigurationValues: &CodeConfigurationValues{
				Runtime: runtime,

				// the properties below are optional
				BuildCommand: jsii.String("buildCommand"),
				Environment: map[string]*string{
					"environmentKey": jsii.String("environment"),
				},
				EnvironmentSecrets: map[string]*secret{
					"environmentSecretsKey": secret,
				},
				EnvironmentVariables: map[string]*string{
					"environmentVariablesKey": jsii.String("environmentVariables"),
				},
				Port: jsii.String("port"),
				StartCommand: jsii.String("startCommand"),
			},
		},
		Connection: gitHubConnection,
		RepositoryUrl: jsii.String("repositoryUrl"),
		SourceCodeVersion: &SourceCodeVersion{
			Type: jsii.String("type"),
			Value: jsii.String("value"),
		},
	},
	EcrRepository: repository,
	ImageRepository: &ImageRepository{
		ImageIdentifier: jsii.String("imageIdentifier"),
		ImageRepositoryType: apprunner_alpha.ImageRepositoryType_ECR_PUBLIC,

		// the properties below are optional
		ImageConfiguration: &ImageConfiguration{
			Environment: map[string]*string{
				"environmentKey": jsii.String("environment"),
			},
			EnvironmentSecrets: map[string]*secret{
				"environmentSecretsKey": secret,
			},
			EnvironmentVariables: map[string]*string{
				"environmentVariablesKey": jsii.String("environmentVariables"),
			},
			Port: jsii.Number(123),
			StartCommand: jsii.String("startCommand"),
		},
	},
}

Experimental.

type VpcConnector

type VpcConnector interface {
	awscdk.Resource
	IVpcConnector
	// Allows specifying security group connections for the VPC connector.
	// Experimental.
	Connections() awsec2.Connections
	// The environment this resource belongs to.
	//
	// For resources that are created and managed by the CDK
	// (generally, those created by creating new class instances like Role, Bucket, etc.),
	// this is always the same as the environment of the stack they belong to;
	// however, for imported resources
	// (those obtained from static methods like fromRoleArn, fromBucketName, etc.),
	// that might be different than the stack they were imported into.
	// Experimental.
	Env() *awscdk.ResourceEnvironment
	// The tree node.
	// Experimental.
	Node() constructs.Node
	// Returns a string-encoded token that resolves to the physical name that should be passed to the CloudFormation resource.
	//
	// This value will resolve to one of the following:
	// - a concrete value (e.g. `"my-awesome-bucket"`)
	// - `undefined`, when a name should be generated by CloudFormation
	// - a concrete name generated automatically during synthesis, in
	//   cross-environment scenarios.
	// Experimental.
	PhysicalName() *string
	// The stack in which this resource is defined.
	// Experimental.
	Stack() awscdk.Stack
	// The ARN of the VPC connector.
	// Experimental.
	VpcConnectorArn() *string
	// The name of the VPC connector.
	// Experimental.
	VpcConnectorName() *string
	// The revision of the VPC connector.
	// Experimental.
	VpcConnectorRevision() *float64
	// Apply the given removal policy to this resource.
	//
	// The Removal Policy controls what happens to this resource when it stops
	// being managed by CloudFormation, either because you've removed it from the
	// CDK application or because you've made a change that requires the resource
	// to be replaced.
	//
	// The resource can be deleted (`RemovalPolicy.DESTROY`), or left in your AWS
	// account for data recovery and cleanup later (`RemovalPolicy.RETAIN`).
	// Experimental.
	ApplyRemovalPolicy(policy awscdk.RemovalPolicy)
	// Experimental.
	GeneratePhysicalName() *string
	// Returns an environment-sensitive token that should be used for the resource's "ARN" attribute (e.g. `bucket.bucketArn`).
	//
	// Normally, this token will resolve to `arnAttr`, but if the resource is
	// referenced across environments, `arnComponents` will be used to synthesize
	// a concrete ARN with the resource's physical name. Make sure to reference
	// `this.physicalName` in `arnComponents`.
	// Experimental.
	GetResourceArnAttribute(arnAttr *string, arnComponents *awscdk.ArnComponents) *string
	// Returns an environment-sensitive token that should be used for the resource's "name" attribute (e.g. `bucket.bucketName`).
	//
	// Normally, this token will resolve to `nameAttr`, but if the resource is
	// referenced across environments, it will be resolved to `this.physicalName`,
	// which will be a concrete name.
	// Experimental.
	GetResourceNameAttribute(nameAttr *string) *string
	// Returns a string representation of this construct.
	// Experimental.
	ToString() *string
}

The App Runner VPC Connector.

Example:

import "github.com/aws/aws-cdk-go/awscdk"

vpc := ec2.NewVpc(this, jsii.String("Vpc"), &VpcProps{
	IpAddresses: ec2.IpAddresses_Cidr(jsii.String("10.0.0.0/16")),
})

vpcConnector := apprunner.NewVpcConnector(this, jsii.String("VpcConnector"), &VpcConnectorProps{
	Vpc: Vpc,
	VpcSubnets: vpc.selectSubnets(&SubnetSelection{
		SubnetType: ec2.SubnetType_PUBLIC,
	}),
	VpcConnectorName: jsii.String("MyVpcConnector"),
})

apprunner.NewService(this, jsii.String("Service"), &ServiceProps{
	Source: apprunner.Source_FromEcrPublic(&EcrPublicProps{
		ImageConfiguration: &ImageConfiguration{
			Port: jsii.Number(8000),
		},
		ImageIdentifier: jsii.String("public.ecr.aws/aws-containers/hello-app-runner:latest"),
	}),
	VpcConnector: VpcConnector,
})

Experimental.

func NewVpcConnector

func NewVpcConnector(scope constructs.Construct, id *string, props *VpcConnectorProps) VpcConnector

Experimental.

type VpcConnectorAttributes

type VpcConnectorAttributes struct {
	// The security groups associated with the VPC connector.
	// Experimental.
	SecurityGroups *[]awsec2.ISecurityGroup `field:"required" json:"securityGroups" yaml:"securityGroups"`
	// The ARN of the VPC connector.
	// Experimental.
	VpcConnectorArn *string `field:"required" json:"vpcConnectorArn" yaml:"vpcConnectorArn"`
	// The name of the VPC connector.
	// Experimental.
	VpcConnectorName *string `field:"required" json:"vpcConnectorName" yaml:"vpcConnectorName"`
	// The revision of the VPC connector.
	// Experimental.
	VpcConnectorRevision *float64 `field:"required" json:"vpcConnectorRevision" yaml:"vpcConnectorRevision"`
}

Attributes for the App Runner VPC Connector.

Example:

// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import apprunner_alpha "github.com/aws/aws-cdk-go/awscdkapprunneralpha"
import "github.com/aws/aws-cdk-go/awscdk"

var securityGroup securityGroup

vpcConnectorAttributes := &VpcConnectorAttributes{
	SecurityGroups: []iSecurityGroup{
		securityGroup,
	},
	VpcConnectorArn: jsii.String("vpcConnectorArn"),
	VpcConnectorName: jsii.String("vpcConnectorName"),
	VpcConnectorRevision: jsii.Number(123),
}

Experimental.

type VpcConnectorProps

type VpcConnectorProps struct {
	// The VPC for the VPC Connector.
	// Experimental.
	Vpc awsec2.IVpc `field:"required" json:"vpc" yaml:"vpc"`
	// A list of IDs of security groups that App Runner should use for access to AWS resources under the specified subnets.
	// Default: - a new security group will be created in the specified VPC.
	//
	// Experimental.
	SecurityGroups *[]awsec2.ISecurityGroup `field:"optional" json:"securityGroups" yaml:"securityGroups"`
	// The name for the VpcConnector.
	// Default: - a name generated by CloudFormation.
	//
	// Experimental.
	VpcConnectorName *string `field:"optional" json:"vpcConnectorName" yaml:"vpcConnectorName"`
	// Where to place the VPC Connector within the VPC.
	// Default: - Private subnets.
	//
	// Experimental.
	VpcSubnets *awsec2.SubnetSelection `field:"optional" json:"vpcSubnets" yaml:"vpcSubnets"`
}

Properties of the AppRunner VPC Connector.

Example:

import "github.com/aws/aws-cdk-go/awscdk"

vpc := ec2.NewVpc(this, jsii.String("Vpc"), &VpcProps{
	IpAddresses: ec2.IpAddresses_Cidr(jsii.String("10.0.0.0/16")),
})

vpcConnector := apprunner.NewVpcConnector(this, jsii.String("VpcConnector"), &VpcConnectorProps{
	Vpc: Vpc,
	VpcSubnets: vpc.selectSubnets(&SubnetSelection{
		SubnetType: ec2.SubnetType_PUBLIC,
	}),
	VpcConnectorName: jsii.String("MyVpcConnector"),
})

apprunner.NewService(this, jsii.String("Service"), &ServiceProps{
	Source: apprunner.Source_FromEcrPublic(&EcrPublicProps{
		ImageConfiguration: &ImageConfiguration{
			Port: jsii.Number(8000),
		},
		ImageIdentifier: jsii.String("public.ecr.aws/aws-containers/hello-app-runner:latest"),
	}),
	VpcConnector: VpcConnector,
})

Experimental.

Directories

Path Synopsis
Package jsii contains the functionaility needed for jsii packages to initialize their dependencies and themselves.
Package jsii contains the functionaility needed for jsii packages to initialize their dependencies and themselves.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL