Skip to content
v2.274.0

Experimental

@aws-cdk/aws-apprunner-alpha is an experimental (alpha) package: its API may change in any release, without a major version bump.

EcrSource Class ​

Represents the service source from ECR.

Example ​

ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import * as apprunner_alpha from '@aws-cdk/aws-apprunner-alpha';
import { aws_ecr as ecr } from 'aws-cdk-lib';

declare const repository: ecr.Repository;
declare const secret: apprunner_alpha.Secret;
const ecrSource = new apprunner_alpha.EcrSource({
  repository: repository,

  // the properties below are optional
  imageConfiguration: {
    environment: {
      environmentKey: 'environment',
    },
    environmentSecrets: {
      environmentSecretsKey: secret,
    },
    environmentVariables: {
      environmentVariablesKey: 'environmentVariables',
    },
    port: 123,
    startCommand: 'startCommand',
  },
  tag: 'tag',
  tagOrDigest: 'tagOrDigest',
});
python
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
import aws_cdk.aws_apprunner_alpha as apprunner_alpha
from aws_cdk import aws_ecr as ecr

# repository: ecr.Repository
# secret: apprunner_alpha.Secret

ecr_source = apprunner_alpha.EcrSource(
    repository=repository,

    # the properties below are optional
    image_configuration=apprunner_alpha.ImageConfiguration(
        environment={
            "environment_key": "environment"
        },
        environment_secrets={
            "environment_secrets_key": secret
        },
        environment_variables={
            "environment_variables_key": "environmentVariables"
        },
        port=123,
        start_command="startCommand"
    ),
    tag="tag",
    tag_or_digest="tagOrDigest"
)
java
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.services.apprunner.alpha.*;
import software.amazon.awscdk.services.ecr.*;

Repository repository;
Secret secret;

EcrSource ecrSource = EcrSource.Builder.create()
        .repository(repository)

        // the properties below are optional
        .imageConfiguration(ImageConfiguration.builder()
                .environment(Map.of(
                        "environmentKey", "environment"))
                .environmentSecrets(Map.of(
                        "environmentSecretsKey", secret))
                .environmentVariables(Map.of(
                        "environmentVariablesKey", "environmentVariables"))
                .port(123)
                .startCommand("startCommand")
                .build())
        .tag("tag")
        .tagOrDigest("tagOrDigest")
        .build();
csharp
// Install: dotnet add package Amazon.CDK.AWS.AppRunner.Alpha
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK.AWS.AppRunner.Alpha;
using Amazon.CDK.AWS.ECR;

Repository repository;
Secret secret;

var ecrSource = new EcrSource(new EcrProps {
    Repository = repository,

    // the properties below are optional
    ImageConfiguration = new ImageConfiguration {
        Environment = new Dictionary<string, string> {
            { "environmentKey", "environment" }
        },
        EnvironmentSecrets = new Dictionary<string, Secret> {
            { "environmentSecretsKey", secret }
        },
        EnvironmentVariables = new Dictionary<string, string> {
            { "environmentVariablesKey", "environmentVariables" }
        },
        Port = 123,
        StartCommand = "startCommand"
    },
    Tag = "tag",
    TagOrDigest = "tagOrDigest"
});
go
// Install: go get github.com/aws/aws-cdk-go/awscdkapprunneralpha/v2
// 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"),
})

Initializer ​

ts
new EcrSource(props: EcrProps)
python
EcrSource(props: EcrProps)
java
new EcrSource(EcrProps props)
csharp
new EcrSource(EcrProps props)
go
NewEcrSource(Props EcrProps)

Methods ​

bind(_scope: Construct): SourceConfigdef bind(self, _scope: Construct) -> SourceConfigpublic SourceConfig bind(Construct _scope)public SourceConfig Bind(Construct _scope)func Bind(_scope Construct) SourceConfig#
Called when the Job is initialized to allow this object to bind.
fromAsset(props: AssetProps): AssetSource@staticmethod def from_asset(props: AssetProps) -> AssetSourcepublic static AssetSource fromAsset(AssetProps props)public static AssetSource FromAsset(AssetProps props)func FromAsset(Props AssetProps) AssetSourcestatic#
Source from local assets.
fromEcr(props: EcrProps): EcrSource // chainable@staticmethod def from_ecr(props: EcrProps) -> EcrSourcepublic static EcrSource fromEcr(EcrProps props)public static EcrSource FromEcr(EcrProps props)func FromEcr(Props EcrProps) EcrSourcestatic#
Source from the ECR repository.
fromEcrPublic(props: EcrPublicProps): EcrPublicSource@staticmethod def from_ecr_public(props: EcrPublicProps) -> EcrPublicSourcepublic static EcrPublicSource fromEcrPublic(EcrPublicProps props)public static EcrPublicSource FromEcrPublic(EcrPublicProps props)func FromEcrPublic(Props EcrPublicProps) EcrPublicSourcestatic#
Source from the ECR Public repository.
fromGitHub(props: GithubRepositoryProps): GithubSource@staticmethod def from_git_hub(props: GithubRepositoryProps) -> GithubSourcepublic static GithubSource fromGitHub(GithubRepositoryProps props)public static GithubSource FromGitHub(GithubRepositoryProps props)func FromGitHub(Props GithubRepositoryProps) GithubSourcestatic#
Source from the GitHub repository.