> **Experimental**
>
> `@aws-cdk/aws-apprunner-alpha` is an [**experimental**](https://docs.aws.amazon.com/cdk/api/stability.html) (alpha) package: its API may change in any release, without a major version bump.
# VpcConnectorProps

Properties of the AppRunner VPC Connector.

Used as props by: [VpcConnector](https://docs.aws.amazon.com/cdk/api/v2/docs/@aws-cdk_aws-apprunner-alpha.VpcConnector.html)

- Stability: [Experimental](https://docs.aws.amazon.com/cdk/api/stability.html)
- Source: [`lib/vpc-connector.ts`](https://github.com/aws/aws-cdk/blob/v2.277.0/packages/@aws-cdk/aws-apprunner-alpha/lib/vpc-connector.ts#L13)

## Example

TypeScript:

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

const vpc = new ec2.Vpc(this, 'Vpc', {
  ipAddresses: ec2.IpAddresses.cidr('10.0.0.0/16')
});

const vpcConnector = new apprunner.VpcConnector(this, 'VpcConnector', {
  vpc,
  vpcSubnets: vpc.selectSubnets({ subnetType: ec2.SubnetType.PUBLIC }),
  vpcConnectorName: 'MyVpcConnector',
});

new apprunner.Service(this, 'Service', {
  source: apprunner.Source.fromEcrPublic({
    imageConfiguration: { port: 8000 },
    imageIdentifier: 'public.ecr.aws/aws-containers/hello-app-runner:latest',
  }),
  vpcConnector,
});
```

Python:

```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
)
```

Java:

```java
import software.amazon.awscdk.services.ec2.*;

Vpc vpc = Vpc.Builder.create(this, "Vpc")
        .ipAddresses(IpAddresses.cidr("10.0.0.0/16"))
        .build();

VpcConnector vpcConnector = VpcConnector.Builder.create(this, "VpcConnector")
        .vpc(vpc)
        .vpcSubnets(vpc.selectSubnets(SubnetSelection.builder().subnetType(SubnetType.PUBLIC).build()))
        .vpcConnectorName("MyVpcConnector")
        .build();

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()))
        .vpcConnector(vpcConnector)
        .build();
```

C# / .NET:

```csharp
// Install: dotnet add package Amazon.CDK.AWS.AppRunner.Alpha
using Amazon.CDK.AWS.EC2;

var vpc = new Vpc(this, "Vpc", new VpcProps {
    IpAddresses = IpAddresses.Cidr("10.0.0.0/16")
});

var vpcConnector = new VpcConnector(this, "VpcConnector", new VpcConnectorProps {
    Vpc = vpc,
    VpcSubnets = vpc.SelectSubnets(new SubnetSelection { SubnetType = SubnetType.PUBLIC }),
    VpcConnectorName = "MyVpcConnector"
});

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"
    }),
    VpcConnector = vpcConnector
});
```

Golang:

```go
// Install: go get github.com/aws/aws-cdk-go/awscdkapprunneralpha/v2
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,
})
```

## Properties

- `securityGroups`: [ISecurityGroup](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ec2.ISecurityGroup.html)[] — 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

- `vpc`: [IVpc](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ec2.IVpc.html) (required) — The VPC for the VPC Connector.

- `vpcConnectorName`: string — The name for the VpcConnector.

  **Default:** a name generated by CloudFormation

- `vpcSubnets`: [SubnetSelection](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ec2.SubnetSelection.html) — Where to place the VPC Connector within the VPC.

  **Default:** Private subnets.
