Skip to content
v2.277.0

Experimental

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

VpcIngressConnectionProps Struct ​

Properties of the AppRunner VPC Ingress Connection.

Example ​

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

declare const vpc: ec2.Vpc;

const interfaceVpcEndpoint = new ec2.InterfaceVpcEndpoint(this, 'MyVpcEndpoint', {
  vpc,
  service: ec2.InterfaceVpcEndpointAwsService.APP_RUNNER_REQUESTS,
  privateDnsEnabled: false,
});

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

new apprunner.VpcIngressConnection(this, 'VpcIngressConnection', {
  vpc,
  interfaceVpcEndpoint,
  service,
});
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
)
java
import software.amazon.awscdk.services.ec2.*;

Vpc vpc;


InterfaceVpcEndpoint interfaceVpcEndpoint = InterfaceVpcEndpoint.Builder.create(this, "MyVpcEndpoint")
        .vpc(vpc)
        .service(InterfaceVpcEndpointAwsService.APP_RUNNER_REQUESTS)
        .privateDnsEnabled(false)
        .build();

Service service = Service.Builder.create(this, "Service")
        .source(Source.fromEcrPublic(EcrPublicProps.builder()
                .imageConfiguration(ImageConfiguration.builder()
                        .port(8000)
                        .build())
                .imageIdentifier("public.ecr.aws/aws-containers/hello-app-runner:latest")
                .build()))
        .isPubliclyAccessible(false)
        .build();

VpcIngressConnection.Builder.create(this, "VpcIngressConnection")
        .vpc(vpc)
        .interfaceVpcEndpoint(interfaceVpcEndpoint)
        .service(service)
        .build();
csharp
// Install: dotnet add package Amazon.CDK.AWS.AppRunner.Alpha
using Amazon.CDK.AWS.EC2;

Vpc vpc;


var interfaceVpcEndpoint = new InterfaceVpcEndpoint(this, "MyVpcEndpoint", new InterfaceVpcEndpointProps {
    Vpc = vpc,
    Service = InterfaceVpcEndpointAwsService.APP_RUNNER_REQUESTS,
    PrivateDnsEnabled = false
});

var service = new Service(this, "Service", new ServiceProps {
    Source = Source.FromEcrPublic(new EcrPublicProps {
        ImageConfiguration = new ImageConfiguration {
            Port = 8000
        },
        ImageIdentifier = "public.ecr.aws/aws-containers/hello-app-runner:latest"
    }),
    IsPubliclyAccessible = false
});

new VpcIngressConnection(this, "VpcIngressConnection", new VpcIngressConnectionProps {
    Vpc = vpc,
    InterfaceVpcEndpoint = interfaceVpcEndpoint,
    Service = service
});
go
// Install: go get github.com/aws/aws-cdk-go/awscdkapprunneralpha/v2
import "github.com/aws/aws-cdk-go/awscdk"

var vpc Vpc


interfaceVpcEndpoint := ec2.NewInterfaceVpcEndpoint(this, jsii.String("MyVpcEndpoint"), &InterfaceVpcEndpointProps{
	Vpc: Vpc,
	Service: ec2.InterfaceVpcEndpointAwsService_APP_RUNNER_REQUESTS(),
	PrivateDnsEnabled: jsii.Boolean(false),
})

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"),
	}),
	IsPubliclyAccessible: jsii.Boolean(false),
})

apprunner.NewVpcIngressConnection(this, jsii.String("VpcIngressConnection"), &VpcIngressConnectionProps{
	Vpc: Vpc,
	InterfaceVpcEndpoint: InterfaceVpcEndpoint,
	Service: Service,
})

Properties ​

interfaceVpcEndpointIInterfaceVpcEndpointinterface_vpc_endpointIInterfaceVpcEndpointinterfaceVpcEndpointIInterfaceVpcEndpointInterfaceVpcEndpointIInterfaceVpcEndpointInterfaceVpcEndpointIInterfaceVpcEndpoint required #
The VPC Interface Endpoint for the VPC Ingress Connection.
serviceIServiceserviceIServiceserviceIServiceServiceIServiceServiceIService required #
The service to connect.
vpcIVpcvpcIVpcvpcIVpcVpcIVpcVpcIVpc required #
The VPC for the VPC Ingress Connection.
vpcIngressConnectionNameoptionalstringvpc_ingress_connection_nameoptionalstrvpcIngressConnectionNameoptionalStringVpcIngressConnectionNameoptionalstringVpcIngressConnectionNameoptional*string #
The name for the VPC Ingress Connection.

Default: a name generated by CloudFormation