|
1 | 1 | import * as fs from 'fs';
|
2 | 2 | import * as path from 'path';
|
| 3 | +import * as ec2 from '@aws-cdk/aws-ec2'; |
3 | 4 | import * as iam from '@aws-cdk/aws-iam';
|
4 | 5 | import * as lambda from '@aws-cdk/aws-lambda';
|
5 | 6 | import * as logs from '@aws-cdk/aws-logs';
|
@@ -314,6 +315,23 @@ export interface AwsCustomResourceProps {
|
314 | 315 | * ID for the function's name. For more information, see Name Type.
|
315 | 316 | */
|
316 | 317 | readonly functionName?: string;
|
| 318 | + |
| 319 | + /** |
| 320 | + * The vpc to provision the lambda function in. |
| 321 | + * |
| 322 | + * @default - the function is not provisioned inside a vpc. |
| 323 | + */ |
| 324 | + readonly vpc?: ec2.IVpc; |
| 325 | + |
| 326 | + /** |
| 327 | + * Which subnets from the VPC to place the lambda function in. |
| 328 | + * |
| 329 | + * Only used if 'vpc' is supplied. Note: internet access for Lambdas |
| 330 | + * requires a NAT gateway, so picking Public subnets is not allowed. |
| 331 | + * |
| 332 | + * @default - the Vpc default strategy if not specified |
| 333 | + */ |
| 334 | + readonly vpcSubnets?: ec2.SubnetSelection; |
317 | 335 | }
|
318 | 336 |
|
319 | 337 | /**
|
@@ -384,6 +402,8 @@ export class AwsCustomResource extends Construct implements iam.IGrantable {
|
384 | 402 | role: props.role,
|
385 | 403 | logRetention: props.logRetention,
|
386 | 404 | functionName: props.functionName,
|
| 405 | + vpc: props.vpc, |
| 406 | + vpcSubnets: props.vpcSubnets, |
387 | 407 | });
|
388 | 408 | this.grantPrincipal = provider.grantPrincipal;
|
389 | 409 |
|
|
0 commit comments