import * as pulumi from "@pulumi/pulumi"; import * as inputs from "../types/input"; import * as outputs from "../types/output"; /** * Manages an AWS Lambda Web function endpoint. An endpoint exposes the web function over HTTPS and routes traffic to one or more revisions. * * ## Example Usage * * ### Basic Usage * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as aws from "@pulumi/aws"; * * const example = new aws.lambdaweb.FunctionEndpoint("example", { * functionName: exampleAwsLambdawebFunctionRevision.functionName, * endpointName: "canary", * endpointType: "HomeRegion", * authType: "ApplicationManaged", * }); * ``` * * ### Weighted (Canary) Routing * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as aws from "@pulumi/aws"; * * const example = new aws.lambdaweb.FunctionEndpoint("example", { * revisionWeights: [ * { * revisionId: exampleAwsLambdawebFunctionRevision[0].revisionId, * weight: 90, * }, * { * revisionId: exampleAwsLambdawebFunctionRevision[1].revisionId, * weight: 10, * }, * ], * functionName: exampleAwsLambdawebFunction.functionName, * endpointName: "prod", * endpointType: "MultiRegion", * regions: [ * "us-east-1", * "eu-west-1", * ], * authType: "IamAuth", * autoDeploymentMode: "Disabled", * }); * ``` * * ### Behind CloudFront * * An endpoint is a plain HTTPS origin, so a distribution can front it to add edge * caching for static paths and terminate TLS closer to the viewer. Use * `domainName` as the origin: on a `MultiRegion` endpoint it routes each request * to the nearest deployed Region, and `regionalDomainNames` is empty because the * service does not publish per-Region domains for that endpoint type. * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as aws from "@pulumi/aws"; * * const app = new aws.lambdaweb.FunctionEndpoint("app", { * revisionWeights: [{ * revisionId: example[0].revisionId, * weight: 100, * }], * functionName: exampleAwsLambdawebFunction.functionName, * endpointName: "public", * endpointType: "MultiRegion", * regions: [ * "us-east-1", * "eu-west-1", * ], * authType: "ApplicationManaged", * autoDeploymentMode: "Disabled", * }); * const disabled = aws.cloudfront.getCachePolicy({ * name: "Managed-CachingDisabled", * }); * const allViewerExceptHost = aws.cloudfront.getOriginRequestPolicy({ * name: "Managed-AllViewerExceptHostHeader", * }); * const appDistribution = new aws.cloudfront.Distribution("app", { * defaultCacheBehavior: { * targetOriginId: "lambdaweb", * viewerProtocolPolicy: "redirect-to-https", * allowedMethods: [ * "GET", * "HEAD", * "OPTIONS", * "PUT", * "POST", * "PATCH", * "DELETE", * ], * cachedMethods: [ * "GET", * "HEAD", * ], * cachePolicyId: disabled.then(disabled => disabled.id), * originRequestPolicyId: allViewerExceptHost.then(allViewerExceptHost => allViewerExceptHost.id), * }, * restrictions: { * geoRestriction: { * restrictionType: "none", * }, * }, * viewerCertificate: { * cloudfrontDefaultCertificate: true, * }, * origins: [{ * customOriginConfig: { * originProtocolPolicy: "https-only", * originSslProtocols: ["TLSv1.2"], * httpPort: 80, * httpsPort: 443, * }, * originId: "lambdaweb", * domainName: app.domainName, * }], * enabled: true, * }); * ``` * * > **Note:** Do not set `defaultRootObject` on a distribution that fronts a * web function. CloudFront rewrites `/` to that object after viewer-request * functions run, which frameworks that own their routing answer with a 404. * * Streaming survives the extra hop: a Server-Sent Events response is relayed * without buffering. Origin groups, on the other hand, reject behaviors that allow * write methods, so a failover group can only serve the read paths and writes need * a behavior pointing at a single origin. A `PerRegion` endpoint is the one that * publishes `regionalDomainNames`, which is what an origin group needs for its * primary and failover members. * * ## Import * * ### Identity Schema * * #### Required * * * `endpointName` (String) Name of the endpoint. * * `functionName` (String) Name of the function. * * #### Optional * * * `accountId` (String) AWS Account where this resource is managed. * * `region` (String) Region where this resource is managed. * * Using `pulumi import`, import a Lambda Web Endpoint using the `functionName` and `endpointName` separated by a comma (`,`). For example: * * ```sh * $ pulumi import aws:lambdaweb/functionEndpoint:FunctionEndpoint example example,canary * ``` */ export declare class FunctionEndpoint extends pulumi.CustomResource { /** * Get an existing FunctionEndpoint resource's state with the given name, ID, and optional extra * properties used to qualify the lookup. * * @param name The _unique_ name of the resulting resource. * @param id The _unique_ provider ID of the resource to lookup. * @param state Any extra arguments used during the lookup. * @param opts Optional settings to control the behavior of the CustomResource. */ static get(name: string, id: pulumi.Input, state?: FunctionEndpointState, opts?: pulumi.CustomResourceOptions): FunctionEndpoint; /** * Check whether an existing FunctionEndpoint resource with the given ID exists. * * @param id The _unique_ provider ID of the resource to check. * @param state Any extra arguments used during the lookup. * @param opts Optional settings to control the behavior of the CustomResource. */ static exists(id: pulumi.Input, state?: FunctionEndpointState, opts?: pulumi.CustomResourceOptions): pulumi.Output; /** * Returns true if the given object is an instance of FunctionEndpoint. This is designed to work even * when multiple copies of the Pulumi SDK have been loaded into the same process. */ static isInstance(obj: any): obj is FunctionEndpoint; /** * ARN of the endpoint in the format `arn:aws:lambda:{region}:{account}:web-function/{function_name}/endpoint/{endpoint_name}`. */ readonly arn: pulumi.Output; /** * Authentication mode. Valid values are `ApplicationManaged` and `IamAuth`. Can be changed in place; the endpoint keeps its domain name. */ readonly authType: pulumi.Output; /** * Deployment mode. `LatestRevision` makes the endpoint follow the latest revision automatically; `Disabled` requires explicit `revisionWeight`s. `MultiRegion` and `PerRegion` endpoints require `Disabled`. Defaults to `LatestRevision`. */ readonly autoDeploymentMode: pulumi.Output; /** * Description of the endpoint. */ readonly description: pulumi.Output; /** * HTTPS domain name of the endpoint. Empty for `PerRegion` endpoints, which only expose `regionalDomainNames`. */ readonly domainName: pulumi.Output; /** * Name of the endpoint, up to 64 characters. Changing this forces a new resource. */ readonly endpointName: pulumi.Output; /** * Endpoint type. Valid values are `HomeRegion`, `MultiRegion`, and `PerRegion`. Changing this forces a new resource. */ readonly endpointType: pulumi.Output; /** * Name of the function this endpoint belongs to, up to 64 characters. Changing this forces a new resource. * * The following arguments are optional: */ readonly functionName: pulumi.Output; /** * Region where this resource will be managed. Defaults to the Region set in the provider configuration. */ readonly region: pulumi.Output; /** * Map of Region to that Region's independent domain name. */ readonly regionalDomainNames: pulumi.Output<{ [key: string]: string; }>; /** * Regions the endpoint spans. The maximum number of Regions per endpoint is a service quota, enforced by the API. Required for `MultiRegion` and `PerRegion` endpoints: specify at least one Region other than the home Region, which is added automatically. For `HomeRegion` endpoints, omit this argument or specify only the home Region. Changing this forces a new resource. */ readonly regions: pulumi.Output; /** * Traffic routing. Required when `autoDeploymentMode` is `Disabled` and must be omitted when `LatestRevision`. One or two entries; weights must sum to 100. See below. When a new revision is rolled on the function, update these weights to shift traffic to it — with `autoDeploymentMode = "Disabled"` traffic never moves automatically. */ readonly revisionWeights: pulumi.Output; /** * Scaling limits for the endpoint. When unset, the endpoint has no `maxEnvironments` limit; removing the block clears a previously set limit. See below. */ readonly scalingConfig: pulumi.Output; /** * Request throttling for the endpoint. When unset, the endpoint has no `rateLimit`; removing the block clears a previously set limit. See below. */ readonly throttleConfig: pulumi.Output; readonly timeouts: pulumi.Output; /** * Create a FunctionEndpoint resource with the given unique name, arguments, and options. * * @param name The _unique_ name of the resource. * @param args The arguments to use to populate this resource's properties. * @param opts A bag of options that control this resource's behavior. */ constructor(name: string, args: FunctionEndpointArgs, opts?: pulumi.CustomResourceOptions); } /** * Input properties used for looking up and filtering FunctionEndpoint resources. */ export interface FunctionEndpointState { /** * ARN of the endpoint in the format `arn:aws:lambda:{region}:{account}:web-function/{function_name}/endpoint/{endpoint_name}`. */ arn?: pulumi.Input; /** * Authentication mode. Valid values are `ApplicationManaged` and `IamAuth`. Can be changed in place; the endpoint keeps its domain name. */ authType?: pulumi.Input; /** * Deployment mode. `LatestRevision` makes the endpoint follow the latest revision automatically; `Disabled` requires explicit `revisionWeight`s. `MultiRegion` and `PerRegion` endpoints require `Disabled`. Defaults to `LatestRevision`. */ autoDeploymentMode?: pulumi.Input; /** * Description of the endpoint. */ description?: pulumi.Input; /** * HTTPS domain name of the endpoint. Empty for `PerRegion` endpoints, which only expose `regionalDomainNames`. */ domainName?: pulumi.Input; /** * Name of the endpoint, up to 64 characters. Changing this forces a new resource. */ endpointName?: pulumi.Input; /** * Endpoint type. Valid values are `HomeRegion`, `MultiRegion`, and `PerRegion`. Changing this forces a new resource. */ endpointType?: pulumi.Input; /** * Name of the function this endpoint belongs to, up to 64 characters. Changing this forces a new resource. * * The following arguments are optional: */ functionName?: pulumi.Input; /** * Region where this resource will be managed. Defaults to the Region set in the provider configuration. */ region?: pulumi.Input; /** * Map of Region to that Region's independent domain name. */ regionalDomainNames?: pulumi.Input<{ [key: string]: pulumi.Input; } | undefined>; /** * Regions the endpoint spans. The maximum number of Regions per endpoint is a service quota, enforced by the API. Required for `MultiRegion` and `PerRegion` endpoints: specify at least one Region other than the home Region, which is added automatically. For `HomeRegion` endpoints, omit this argument or specify only the home Region. Changing this forces a new resource. */ regions?: pulumi.Input[] | undefined>; /** * Traffic routing. Required when `autoDeploymentMode` is `Disabled` and must be omitted when `LatestRevision`. One or two entries; weights must sum to 100. See below. When a new revision is rolled on the function, update these weights to shift traffic to it — with `autoDeploymentMode = "Disabled"` traffic never moves automatically. */ revisionWeights?: pulumi.Input[] | undefined>; /** * Scaling limits for the endpoint. When unset, the endpoint has no `maxEnvironments` limit; removing the block clears a previously set limit. See below. */ scalingConfig?: pulumi.Input; /** * Request throttling for the endpoint. When unset, the endpoint has no `rateLimit`; removing the block clears a previously set limit. See below. */ throttleConfig?: pulumi.Input; timeouts?: pulumi.Input; } /** * The set of arguments for constructing a FunctionEndpoint resource. */ export interface FunctionEndpointArgs { /** * Authentication mode. Valid values are `ApplicationManaged` and `IamAuth`. Can be changed in place; the endpoint keeps its domain name. */ authType: pulumi.Input; /** * Deployment mode. `LatestRevision` makes the endpoint follow the latest revision automatically; `Disabled` requires explicit `revisionWeight`s. `MultiRegion` and `PerRegion` endpoints require `Disabled`. Defaults to `LatestRevision`. */ autoDeploymentMode?: pulumi.Input; /** * Description of the endpoint. */ description?: pulumi.Input; /** * Name of the endpoint, up to 64 characters. Changing this forces a new resource. */ endpointName: pulumi.Input; /** * Endpoint type. Valid values are `HomeRegion`, `MultiRegion`, and `PerRegion`. Changing this forces a new resource. */ endpointType: pulumi.Input; /** * Name of the function this endpoint belongs to, up to 64 characters. Changing this forces a new resource. * * The following arguments are optional: */ functionName: pulumi.Input; /** * Region where this resource will be managed. Defaults to the Region set in the provider configuration. */ region?: pulumi.Input; /** * Regions the endpoint spans. The maximum number of Regions per endpoint is a service quota, enforced by the API. Required for `MultiRegion` and `PerRegion` endpoints: specify at least one Region other than the home Region, which is added automatically. For `HomeRegion` endpoints, omit this argument or specify only the home Region. Changing this forces a new resource. */ regions?: pulumi.Input[] | undefined>; /** * Traffic routing. Required when `autoDeploymentMode` is `Disabled` and must be omitted when `LatestRevision`. One or two entries; weights must sum to 100. See below. When a new revision is rolled on the function, update these weights to shift traffic to it — with `autoDeploymentMode = "Disabled"` traffic never moves automatically. */ revisionWeights?: pulumi.Input[] | undefined>; /** * Scaling limits for the endpoint. When unset, the endpoint has no `maxEnvironments` limit; removing the block clears a previously set limit. See below. */ scalingConfig?: pulumi.Input; /** * Request throttling for the endpoint. When unset, the endpoint has no `rateLimit`; removing the block clears a previously set limit. See below. */ throttleConfig?: pulumi.Input; timeouts?: pulumi.Input; } //# sourceMappingURL=functionEndpoint.d.ts.map