class VpcOrigin
Language | Type name |
---|---|
![]() | Amazon.CDK.AWS.CloudFront.Origins.VpcOrigin |
![]() | github.com/aws/aws-cdk-go/awscdk/v2/awscloudfrontorigins#VpcOrigin |
![]() | software.amazon.awscdk.services.cloudfront.origins.VpcOrigin |
![]() | aws_cdk.aws_cloudfront_origins.VpcOrigin |
![]() | aws-cdk-lib » aws_cloudfront_origins » VpcOrigin |
Implements
IOrigin
Extends
Origin
Represents a distribution's VPC origin.
Example
// Creates a distribution from a Network Load Balancer
declare const vpc: ec2.Vpc;
// Create a network load balancer in a VPC. 'internetFacing' can be 'false'.
const nlb = new elbv2.NetworkLoadBalancer(this, 'NLB', {
vpc,
internetFacing: false,
vpcSubnets: { subnetType: ec2.SubnetType.PRIVATE_ISOLATED },
securityGroups: [new ec2.SecurityGroup(this, 'NLB-SG', { vpc })],
});
new cloudfront.Distribution(this, 'myDist', {
defaultBehavior: { origin: origins.VpcOrigin.withNetworkLoadBalancer(nlb) },
});
Initializer (protected)
super(domainName: string, props: VpcOriginProps)
Parameters
- domainName
string
- props
Vpc
Origin Props
Properties
Name | Type | Description |
---|---|---|
props | Vpc | |
vpc | IVpc |
props
Type:
Vpc
vpcOrigin?
Type:
IVpc
(optional)
Methods
Name | Description |
---|---|
bind(scope, options) | Binds the origin to the associated Distribution. |
protected render | |
static with | Create a VPC origin with an Application Load Balancer. |
static with | Create a VPC origin with an EC2 instance. |
static with | Create a VPC origin with a Network Load Balancer. |
static with | Create a VPC origin with an existing VPC origin resource. |
bind(scope, options)
public bind(scope: Construct, options: OriginBindOptions): OriginBindConfig
Parameters
- scope
Construct
- options
Origin
Bind Options
Returns
Binds the origin to the associated Distribution.
Can be used to grant permissions, create dependent resources, etc.
protected renderVpcOriginConfig()
protected renderVpcOriginConfig(): VpcOriginConfigProperty
Returns
static withApplicationLoadBalancer(alb, props?)
public static withApplicationLoadBalancer(alb: IApplicationLoadBalancer, props?: VpcOriginWithEndpointProps): VpcOrigin
Parameters
Returns
Create a VPC origin with an Application Load Balancer.
static withEc2Instance(instance, props?)
public static withEc2Instance(instance: IInstance, props?: VpcOriginWithEndpointProps): VpcOrigin
Parameters
- instance
IInstance
- props
Vpc
Origin With Endpoint Props
Returns
Create a VPC origin with an EC2 instance.
static withNetworkLoadBalancer(nlb, props?)
public static withNetworkLoadBalancer(nlb: INetworkLoadBalancer, props?: VpcOriginWithEndpointProps): VpcOrigin
Parameters
Returns
Create a VPC origin with a Network Load Balancer.
static withVpcOrigin(origin, props?)
public static withVpcOrigin(origin: IVpcOrigin, props?: VpcOriginProps): VpcOrigin
Parameters
- origin
IVpc
Origin - props
Vpc
Origin Props
Returns
Create a VPC origin with an existing VPC origin resource.