Classes
| Name | Description |
|---|---|
| AntiHotlinking | The Anti-Hotlinking extension. |
| Custom | Custom extension sample. |
| DefaultDirIndex | Default Directory Indexes in Amazon S3-backed Amazon CloudFront Origins. |
| Distribution | No description |
| ModifyResponseHeader | The modify response header extension. |
| SecurtyHeaders | Security Headers extension. |
| SelectOriginByViwerCountry | selective origin by viewer counry. |
| ServerlessApp | No description |
| SimpleLambdaEdge | Simple content generation. |
Structs
| Name | Description |
|---|---|
| AntiHotlinkingProps | Construct properties for AntiHotlinking. |
| CustomProps | No description |
| DistributionProps | No description |
| SelectOriginByViwerCountryProps | No description |
| ServerlessAppProps | Construct properties for ServerlessApp. |
Interfaces
| Name | Description |
|---|---|
| IExtensions | The Extension interface. |
The Anti-Hotlinking extension.
Implements: IConstruct, IConstruct, IConstruct, IDependable, IExtensions Extends: ServerlessApp
new AntiHotlinking(scope: Construct, id: string, props: AntiHotlinkingProps)- scope (
Construct) No description - id (
string) No description - props (
AntiHotlinkingProps) No description- referer (
Array) Referer allow list with wildcard(* and ?) support i.e.example.comorexa?ple.*.
- referer (
| Name | Type | Description |
|---|---|---|
| eventType | LambdaEdgeEventType |
The Lambda edge event type for this extension. |
| functionArn | string |
Lambda function ARN for this extension. |
| functionVersion | Version |
Lambda function version for the function. |
Custom extension sample.
Implements: IConstruct, IConstruct, IConstruct, IDependable, ITaggable, IExtensions Extends: NestedStack
new Custom(scope: Construct, id: string, props: CustomProps)- scope (
Construct) No description - id (
string) No description - props (
CustomProps) No description- code (
AssetCode) The source code of your Lambda function. Default: Code.fromAsset(path.join(__dirname, '../lambda/function')) - eventType (
LambdaEdgeEventType) The type of event in response to which should the function be invoked. Default: LambdaEdgeEventType.ORIGIN_RESPONSE - func (
Function) Specify your Lambda function. Optional - handler (
string) The name of the method within your code that Lambda calls to execute your function. Default: index.lambda_handler - runtime (
Runtime) The runtime environment for the Lambda function that you are uploading. Default: Runtime.PYTHON_3_8 - solutionId (
string) The solution identifier. Default: no identifier - templateDescription (
string) The template description. Default: '' - timeout (
Duration) The function execution time (in seconds) after which Lambda terminates the function. Default: Duration.seconds(5)
- code (
| Name | Type | Description |
|---|---|---|
| eventType | LambdaEdgeEventType |
The Lambda edge event type for this extension. |
| functionArn | string |
Lambda function ARN for this extension. |
| functionVersion | Version |
Lambda function version for the function. |
| props | CustomProps |
Default Directory Indexes in Amazon S3-backed Amazon CloudFront Origins.
Implements: IConstruct, IConstruct, IConstruct, IDependable, ITaggable, IExtensions Extends: Custom
new DefaultDirIndex(scope: Construct, id: string)- scope (
Construct) No description - id (
string) No description
| Name | Type | Description |
|---|---|---|
| lambdaFunction | Version |
Implements: IConstruct, IConstruct, IConstruct, IDependable Extends: Construct
new Distribution(scope: Construct, id: string, props: DistributionProps)- scope (
Construct) No description - id (
string) No description - props (
DistributionProps) No description- defaultBehavior (
BehaviorOptions) The default behavior for the distribution. - additionalBehaviors (
Map<string, BehaviorOptions>) Additional behaviors for the distribution, mapped by the pathPattern that specifies which requests to apply the behavior to. Default: no additional behaviors are added. - certificate (
ICertificate) A certificate to associate with the distribution. Default: the CloudFront wildcard certificate (*.cloudfront.net) will be used. - comment (
string) Any comments you want to include about the distribution. Default: no comment - defaultRootObject (
string) The object that you want CloudFront to request from your origin (for example, index.html) when a viewer requests the root URL for your distribution. If no default object is set, the request goes to the origin's root (e.g., example.com/). Default: no default root object - domainNames (
Array) Alternative domain names for this distribution. Default: The distribution will only support the default generated name (e.g., d111111abcdef8.cloudfront.net) - enabled (
boolean) Enable or disable the distribution. Default: true - enableIpv6 (
boolean) Whether CloudFront will respond to IPv6 DNS requests with an IPv6 address. Default: true - enableLogging (
boolean) Enable access logging for the distribution. Default: false, unlesslogBucketis specified. - errorResponses (
Array<ErrorResponse>) How CloudFront should handle requests that are not successful (e.g., PageNotFound). Default: No custom error responses. - geoRestriction (
GeoRestriction) Controls the countries in which your content is distributed. Default: No geographic restrictions - httpVersion (
HttpVersion) Specify the maximum HTTP version that you want viewers to use to communicate with CloudFront. Default: HttpVersion.HTTP2 - logBucket (
IBucket) The Amazon S3 bucket to store the access logs in. Default: A bucket is created ifenableLoggingis true - logFilePrefix (
string) An optional string that you want CloudFront to prefix to the access log filenames for this distribution. Default: no prefix - logIncludesCookies (
boolean) Specifies whether you want CloudFront to include cookies in access logs. Default: false - minimumProtocolVersion (
SecurityPolicyProtocol) The minimum version of the SSL protocol that you want CloudFront to use for HTTPS connections. Default: SecurityPolicyProtocol.TLS_V1_2_2019 - priceClass (
PriceClass) The price class that corresponds with the maximum price that you want to pay for CloudFront service. Default: PriceClass.PRICE_CLASS_ALL - webAclId (
string) Unique identifier that specifies the AWS WAF web ACL to associate with this CloudFront distribution. Default: No AWS Web Application Firewall web access control list (web ACL).
- defaultBehavior (
| Name | Type | Description |
|---|---|---|
| extensions | Array<IExtensions> |
The modify response header extension.
Implements: IConstruct, IConstruct, IConstruct, IDependable, IExtensions Extends: ServerlessApp
new ModifyResponseHeader(scope: Construct, id: string)- scope (
Construct) No description - id (
string) No description
| Name | Type | Description |
|---|---|---|
| eventType | LambdaEdgeEventType |
The Lambda edge event type for this extension. |
| functionArn | string |
Lambda function ARN for this extension. |
| functionVersion | Version |
Lambda function version for the function. |
Security Headers extension.
Implements: IConstruct, IConstruct, IConstruct, IDependable, IExtensions Extends: ServerlessApp
new SecurtyHeaders(scope: Construct, id: string)- scope (
Construct) No description - id (
string) No description
| Name | Type | Description |
|---|---|---|
| eventType | LambdaEdgeEventType |
The Lambda edge event type for this extension. |
| functionArn | string |
Lambda function ARN for this extension. |
| functionVersion | Version |
Lambda function version for the function. |
selective origin by viewer counry.
Implements: IConstruct, IConstruct, IConstruct, IDependable, ITaggable, IExtensions Extends: Custom
new SelectOriginByViwerCountry(scope: Construct, id: string, props: SelectOriginByViwerCountryProps)- scope (
Construct) No description - id (
string) No description - props (
SelectOriginByViwerCountryProps) No description- countryTable (
Map<string, string>) The pre-defined country code table.
- countryTable (
Implements: IConstruct, IConstruct, IConstruct, IDependable Extends: Construct
new ServerlessApp(scope: Construct, id: string, props: ServerlessAppProps)- scope (
Construct) No description - id (
string) No description - props (
ServerlessAppProps) No description- applicationId (
string) No description - semanticVersion (
string) No description - parameters (
Map<string, string>) The parameters for the ServerlessApp. Optional
- applicationId (
| Name | Type | Description |
|---|---|---|
| resource | CfnResource |
Simple content generation.
Implements: IConstruct, IConstruct, IConstruct, IDependable, ITaggable, IExtensions Extends: Custom
new SimpleLambdaEdge(scope: Construct, id: string)- scope (
Construct) No description - id (
string) No description
Construct properties for AntiHotlinking.
| Name | Type | Description |
|---|---|---|
| referer | Array |
Referer allow list with wildcard(* and ?) support i.e. example.com or exa?ple.*. |
| Name | Type | Description |
|---|---|---|
| code? | AssetCode |
The source code of your Lambda function. Default: Code.fromAsset(path.join(__dirname, '../lambda/function')) |
| eventType? | LambdaEdgeEventType |
The type of event in response to which should the function be invoked. Default: LambdaEdgeEventType.ORIGIN_RESPONSE |
| func? | Function |
Specify your Lambda function. Optional |
| handler? | string |
The name of the method within your code that Lambda calls to execute your function. Default: index.lambda_handler |
| runtime? | Runtime |
The runtime environment for the Lambda function that you are uploading. Default: Runtime.PYTHON_3_8 |
| solutionId? | string |
The solution identifier. Default: no identifier |
| templateDescription? | string |
The template description. Default: '' |
| timeout? | Duration |
The function execution time (in seconds) after which Lambda terminates the function. Default: Duration.seconds(5) |
| Name | Type | Description |
|---|---|---|
| defaultBehavior | BehaviorOptions |
The default behavior for the distribution. |
| additionalBehaviors? | Map<string, BehaviorOptions> |
Additional behaviors for the distribution, mapped by the pathPattern that specifies which requests to apply the behavior to. Default: no additional behaviors are added. |
| certificate? | ICertificate |
A certificate to associate with the distribution. Default: the CloudFront wildcard certificate (*.cloudfront.net) will be used. |
| comment? | string |
Any comments you want to include about the distribution. Default: no comment |
| defaultRootObject? | string |
The object that you want CloudFront to request from your origin (for example, index.html) when a viewer requests the root URL for your distribution. If no default object is set, the request goes to the origin's root (e.g., example.com/). Default: no default root object |
| domainNames? | Array |
Alternative domain names for this distribution. Default: The distribution will only support the default generated name (e.g., d111111abcdef8.cloudfront.net) |
| enableIpv6? | boolean |
Whether CloudFront will respond to IPv6 DNS requests with an IPv6 address. Default: true |
| enableLogging? | boolean |
Enable access logging for the distribution. Default: false, unless logBucket is specified. |
| enabled? | boolean |
Enable or disable the distribution. Default: true |
| errorResponses? | Array<ErrorResponse> |
How CloudFront should handle requests that are not successful (e.g., PageNotFound). Default: No custom error responses. |
| geoRestriction? | GeoRestriction |
Controls the countries in which your content is distributed. Default: No geographic restrictions |
| httpVersion? | HttpVersion |
Specify the maximum HTTP version that you want viewers to use to communicate with CloudFront. Default: HttpVersion.HTTP2 |
| logBucket? | IBucket |
The Amazon S3 bucket to store the access logs in. Default: A bucket is created if enableLogging is true |
| logFilePrefix? | string |
An optional string that you want CloudFront to prefix to the access log filenames for this distribution. Default: no prefix |
| logIncludesCookies? | boolean |
Specifies whether you want CloudFront to include cookies in access logs. Default: false |
| minimumProtocolVersion? | SecurityPolicyProtocol |
The minimum version of the SSL protocol that you want CloudFront to use for HTTPS connections. Default: SecurityPolicyProtocol.TLS_V1_2_2019 |
| priceClass? | PriceClass |
The price class that corresponds with the maximum price that you want to pay for CloudFront service. Default: PriceClass.PRICE_CLASS_ALL |
| webAclId? | string |
Unique identifier that specifies the AWS WAF web ACL to associate with this CloudFront distribution. Default: No AWS Web Application Firewall web access control list (web ACL). |
Implemented by: AntiHotlinking, Custom, DefaultDirIndex, ModifyResponseHeader, SecurtyHeaders, SelectOriginByViwerCountry, SimpleLambdaEdge
The Extension interface.
| Name | Type | Description |
|---|---|---|
| eventType | LambdaEdgeEventType |
The Lambda edge event type for this extension. |
| functionArn | string |
Lambda function ARN for this extension. |
| functionVersion | Version |
Lambda function version for the function. |
| Name | Type | Description |
|---|---|---|
| countryTable | Map<string, string> |
The pre-defined country code table. |
Construct properties for ServerlessApp.
| Name | Type | Description |
|---|---|---|
| applicationId | string |
|
| semanticVersion | string |
|
| parameters? | Map<string, string> |
The parameters for the ServerlessApp. Optional |