@ashishpandeyone/cdk-lambda-web-function 0.1.4 → 0.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.jsii +242 -69
- package/.jsii.tabl.json +1 -1
- package/API.md +192 -2
- package/README.md +44 -7
- package/lib/nodejs-web-function.js +1 -1
- package/lib/private/resource-policy.d.ts +15 -0
- package/lib/private/resource-policy.js +48 -0
- package/lib/web-function-deployment.js +1 -1
- package/lib/web-function-endpoint.js +3 -3
- package/lib/web-function-grants.d.ts +6 -1
- package/lib/web-function-grants.js +14 -10
- package/lib/web-function-revision.js +1 -1
- package/lib/web-function.d.ts +62 -2
- package/lib/web-function.js +73 -3
- package/package.json +1 -1
package/API.md
CHANGED
|
@@ -51,6 +51,7 @@ new NodejsWebFunction(scope: Construct, id: string, props: NodejsWebFunctionProp
|
|
|
51
51
|
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.with">with</a></code> | Applies one or more mixins to this construct. |
|
|
52
52
|
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.applyCrossStackReferenceStrength">applyCrossStackReferenceStrength</a></code> | Override the cross-stack reference strength for this resource. |
|
|
53
53
|
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.applyRemovalPolicy">applyRemovalPolicy</a></code> | Apply the given removal policy to this resource. |
|
|
54
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.addToResourcePolicy">addToResourcePolicy</a></code> | Adds a statement to the function's resource policy, e.g. to let another account manage the function. For invoking, prefer `addPermission` or `grantInvoke`. |
|
|
54
55
|
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.grantInvoke">grantInvoke</a></code> | Allows `grantee` to call the endpoint. |
|
|
55
56
|
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.metric">metric</a></code> | A metric of this function's execution environments in `AWS/Lambda/Web` (dimension `FunctionName`), across all endpoints. |
|
|
56
57
|
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.metricActiveTime">metricActiveTime</a></code> | Time the execution environments were active (`EnvironmentActiveTime`). |
|
|
@@ -60,6 +61,7 @@ new NodejsWebFunction(scope: Construct, id: string, props: NodejsWebFunctionProp
|
|
|
60
61
|
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.metricResponseBytes">metricResponseBytes</a></code> | Bytes sent in responses (`ResponseBytes`). |
|
|
61
62
|
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.addEndpoint">addEndpoint</a></code> | Adds an endpoint (up to 10 per function), e.g. a public one next to an IAM-only one, or one pinned to an earlier revision. Each endpoint has its own URL, authentication, regions and limits. |
|
|
62
63
|
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.addEnvironment">addEnvironment</a></code> | Adds an environment variable. |
|
|
64
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.addPermission">addPermission</a></code> | Allows a principal in another account, an AWS service or an organization to call the function's endpoints, through the function's resource policy. |
|
|
63
65
|
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.addToRolePolicy">addToRolePolicy</a></code> | Adds a statement to the execution role's policy. |
|
|
64
66
|
|
|
65
67
|
---
|
|
@@ -135,6 +137,24 @@ account for data recovery and cleanup later (`RemovalPolicy.RETAIN`).
|
|
|
135
137
|
|
|
136
138
|
---
|
|
137
139
|
|
|
140
|
+
##### `addToResourcePolicy` <a name="addToResourcePolicy" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.addToResourcePolicy"></a>
|
|
141
|
+
|
|
142
|
+
```typescript
|
|
143
|
+
public addToResourcePolicy(statement: PolicyStatement): AddToResourcePolicyResult
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
Adds a statement to the function's resource policy, e.g. to let another account manage the function. For invoking, prefer `addPermission` or `grantInvoke`.
|
|
147
|
+
|
|
148
|
+
The function has one resource policy (`AWS::Lambda::ResourcePolicy`), created on the first statement. This stack
|
|
149
|
+
is its only writer: another stack or template can't also attach one, and changes made outside CloudFormation
|
|
150
|
+
are overwritten by the next update of the policy.
|
|
151
|
+
|
|
152
|
+
###### `statement`<sup>Required</sup> <a name="statement" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.addToResourcePolicy.parameter.statement"></a>
|
|
153
|
+
|
|
154
|
+
- *Type:* aws-cdk-lib.aws_iam.PolicyStatement
|
|
155
|
+
|
|
156
|
+
---
|
|
157
|
+
|
|
138
158
|
##### `grantInvoke` <a name="grantInvoke" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.grantInvoke"></a>
|
|
139
159
|
|
|
140
160
|
```typescript
|
|
@@ -293,6 +313,30 @@ Names starting with `AWS_` are reserved.
|
|
|
293
313
|
|
|
294
314
|
---
|
|
295
315
|
|
|
316
|
+
##### `addPermission` <a name="addPermission" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.addPermission"></a>
|
|
317
|
+
|
|
318
|
+
```typescript
|
|
319
|
+
public addPermission(id: string, permission: WebFunctionPermission): void
|
|
320
|
+
```
|
|
321
|
+
|
|
322
|
+
Allows a principal in another account, an AWS service or an organization to call the function's endpoints, through the function's resource policy.
|
|
323
|
+
|
|
324
|
+
For a role in this account, use `grantInvoke`.
|
|
325
|
+
|
|
326
|
+
###### `id`<sup>Required</sup> <a name="id" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.addPermission.parameter.id"></a>
|
|
327
|
+
|
|
328
|
+
- *Type:* string
|
|
329
|
+
|
|
330
|
+
the statement ID (`Sid`): letters and digits, unique within the function.
|
|
331
|
+
|
|
332
|
+
---
|
|
333
|
+
|
|
334
|
+
###### `permission`<sup>Required</sup> <a name="permission" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.addPermission.parameter.permission"></a>
|
|
335
|
+
|
|
336
|
+
- *Type:* <a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionPermission">WebFunctionPermission</a>
|
|
337
|
+
|
|
338
|
+
---
|
|
339
|
+
|
|
296
340
|
##### `addToRolePolicy` <a name="addToRolePolicy" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.addToRolePolicy"></a>
|
|
297
341
|
|
|
298
342
|
```typescript
|
|
@@ -713,6 +757,7 @@ new WebFunction(scope: Construct, id: string, props: WebFunctionProps)
|
|
|
713
757
|
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunction.with">with</a></code> | Applies one or more mixins to this construct. |
|
|
714
758
|
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunction.applyCrossStackReferenceStrength">applyCrossStackReferenceStrength</a></code> | Override the cross-stack reference strength for this resource. |
|
|
715
759
|
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunction.applyRemovalPolicy">applyRemovalPolicy</a></code> | Apply the given removal policy to this resource. |
|
|
760
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunction.addToResourcePolicy">addToResourcePolicy</a></code> | Adds a statement to the function's resource policy, e.g. to let another account manage the function. For invoking, prefer `addPermission` or `grantInvoke`. |
|
|
716
761
|
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunction.grantInvoke">grantInvoke</a></code> | Allows `grantee` to call the endpoint. |
|
|
717
762
|
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunction.metric">metric</a></code> | A metric of this function's execution environments in `AWS/Lambda/Web` (dimension `FunctionName`), across all endpoints. |
|
|
718
763
|
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunction.metricActiveTime">metricActiveTime</a></code> | Time the execution environments were active (`EnvironmentActiveTime`). |
|
|
@@ -722,6 +767,7 @@ new WebFunction(scope: Construct, id: string, props: WebFunctionProps)
|
|
|
722
767
|
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunction.metricResponseBytes">metricResponseBytes</a></code> | Bytes sent in responses (`ResponseBytes`). |
|
|
723
768
|
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunction.addEndpoint">addEndpoint</a></code> | Adds an endpoint (up to 10 per function), e.g. a public one next to an IAM-only one, or one pinned to an earlier revision. Each endpoint has its own URL, authentication, regions and limits. |
|
|
724
769
|
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunction.addEnvironment">addEnvironment</a></code> | Adds an environment variable. |
|
|
770
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunction.addPermission">addPermission</a></code> | Allows a principal in another account, an AWS service or an organization to call the function's endpoints, through the function's resource policy. |
|
|
725
771
|
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunction.addToRolePolicy">addToRolePolicy</a></code> | Adds a statement to the execution role's policy. |
|
|
726
772
|
|
|
727
773
|
---
|
|
@@ -797,6 +843,24 @@ account for data recovery and cleanup later (`RemovalPolicy.RETAIN`).
|
|
|
797
843
|
|
|
798
844
|
---
|
|
799
845
|
|
|
846
|
+
##### `addToResourcePolicy` <a name="addToResourcePolicy" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.addToResourcePolicy"></a>
|
|
847
|
+
|
|
848
|
+
```typescript
|
|
849
|
+
public addToResourcePolicy(statement: PolicyStatement): AddToResourcePolicyResult
|
|
850
|
+
```
|
|
851
|
+
|
|
852
|
+
Adds a statement to the function's resource policy, e.g. to let another account manage the function. For invoking, prefer `addPermission` or `grantInvoke`.
|
|
853
|
+
|
|
854
|
+
The function has one resource policy (`AWS::Lambda::ResourcePolicy`), created on the first statement. This stack
|
|
855
|
+
is its only writer: another stack or template can't also attach one, and changes made outside CloudFormation
|
|
856
|
+
are overwritten by the next update of the policy.
|
|
857
|
+
|
|
858
|
+
###### `statement`<sup>Required</sup> <a name="statement" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.addToResourcePolicy.parameter.statement"></a>
|
|
859
|
+
|
|
860
|
+
- *Type:* aws-cdk-lib.aws_iam.PolicyStatement
|
|
861
|
+
|
|
862
|
+
---
|
|
863
|
+
|
|
800
864
|
##### `grantInvoke` <a name="grantInvoke" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.grantInvoke"></a>
|
|
801
865
|
|
|
802
866
|
```typescript
|
|
@@ -955,6 +1019,30 @@ Names starting with `AWS_` are reserved.
|
|
|
955
1019
|
|
|
956
1020
|
---
|
|
957
1021
|
|
|
1022
|
+
##### `addPermission` <a name="addPermission" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.addPermission"></a>
|
|
1023
|
+
|
|
1024
|
+
```typescript
|
|
1025
|
+
public addPermission(id: string, permission: WebFunctionPermission): void
|
|
1026
|
+
```
|
|
1027
|
+
|
|
1028
|
+
Allows a principal in another account, an AWS service or an organization to call the function's endpoints, through the function's resource policy.
|
|
1029
|
+
|
|
1030
|
+
For a role in this account, use `grantInvoke`.
|
|
1031
|
+
|
|
1032
|
+
###### `id`<sup>Required</sup> <a name="id" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.addPermission.parameter.id"></a>
|
|
1033
|
+
|
|
1034
|
+
- *Type:* string
|
|
1035
|
+
|
|
1036
|
+
the statement ID (`Sid`): letters and digits, unique within the function.
|
|
1037
|
+
|
|
1038
|
+
---
|
|
1039
|
+
|
|
1040
|
+
###### `permission`<sup>Required</sup> <a name="permission" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.addPermission.parameter.permission"></a>
|
|
1041
|
+
|
|
1042
|
+
- *Type:* <a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionPermission">WebFunctionPermission</a>
|
|
1043
|
+
|
|
1044
|
+
---
|
|
1045
|
+
|
|
958
1046
|
##### `addToRolePolicy` <a name="addToRolePolicy" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.addToRolePolicy"></a>
|
|
959
1047
|
|
|
960
1048
|
```typescript
|
|
@@ -1369,6 +1457,7 @@ new WebFunctionBase(scope: Construct, id: string, props?: ResourceProps)
|
|
|
1369
1457
|
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionBase.with">with</a></code> | Applies one or more mixins to this construct. |
|
|
1370
1458
|
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionBase.applyCrossStackReferenceStrength">applyCrossStackReferenceStrength</a></code> | Override the cross-stack reference strength for this resource. |
|
|
1371
1459
|
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionBase.applyRemovalPolicy">applyRemovalPolicy</a></code> | Apply the given removal policy to this resource. |
|
|
1460
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionBase.addToResourcePolicy">addToResourcePolicy</a></code> | Adds a statement to the function's resource policy (not added for an imported function). |
|
|
1372
1461
|
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionBase.grantInvoke">grantInvoke</a></code> | Allows `grantee` to call the function's endpoint. |
|
|
1373
1462
|
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionBase.metric">metric</a></code> | A metric of this function's execution environments in `AWS/Lambda/Web` (dimension `FunctionName`), across all endpoints. |
|
|
1374
1463
|
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionBase.metricActiveTime">metricActiveTime</a></code> | Time the execution environments were active (`EnvironmentActiveTime`). |
|
|
@@ -1450,6 +1539,20 @@ account for data recovery and cleanup later (`RemovalPolicy.RETAIN`).
|
|
|
1450
1539
|
|
|
1451
1540
|
---
|
|
1452
1541
|
|
|
1542
|
+
##### `addToResourcePolicy` <a name="addToResourcePolicy" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionBase.addToResourcePolicy"></a>
|
|
1543
|
+
|
|
1544
|
+
```typescript
|
|
1545
|
+
public addToResourcePolicy(statement: PolicyStatement): AddToResourcePolicyResult
|
|
1546
|
+
```
|
|
1547
|
+
|
|
1548
|
+
Adds a statement to the function's resource policy (not added for an imported function).
|
|
1549
|
+
|
|
1550
|
+
###### `statement`<sup>Required</sup> <a name="statement" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionBase.addToResourcePolicy.parameter.statement"></a>
|
|
1551
|
+
|
|
1552
|
+
- *Type:* aws-cdk-lib.aws_iam.PolicyStatement
|
|
1553
|
+
|
|
1554
|
+
---
|
|
1555
|
+
|
|
1453
1556
|
##### `grantInvoke` <a name="grantInvoke" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionBase.grantInvoke"></a>
|
|
1454
1557
|
|
|
1455
1558
|
```typescript
|
|
@@ -3635,6 +3738,84 @@ Renaming a function replaces it, and its endpoint gets a new URL.
|
|
|
3635
3738
|
|
|
3636
3739
|
---
|
|
3637
3740
|
|
|
3741
|
+
### WebFunctionPermission <a name="WebFunctionPermission" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionPermission"></a>
|
|
3742
|
+
|
|
3743
|
+
Permission for a principal outside this account, an AWS service or an organization to call a function's endpoints.
|
|
3744
|
+
|
|
3745
|
+
#### Initializer <a name="Initializer" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionPermission.Initializer"></a>
|
|
3746
|
+
|
|
3747
|
+
```typescript
|
|
3748
|
+
import { WebFunctionPermission } from '@ashishpandeyone/cdk-lambda-web-function'
|
|
3749
|
+
|
|
3750
|
+
const webFunctionPermission: WebFunctionPermission = { ... }
|
|
3751
|
+
```
|
|
3752
|
+
|
|
3753
|
+
#### Properties <a name="Properties" id="Properties"></a>
|
|
3754
|
+
|
|
3755
|
+
| **Name** | **Type** | **Description** |
|
|
3756
|
+
| --- | --- | --- |
|
|
3757
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionPermission.property.principal">principal</a></code> | <code>aws-cdk-lib.aws_iam.IPrincipal</code> | Who may call: an account (`iam.AccountPrincipal`), a role or user (`iam.ArnPrincipal`), an AWS service (`iam.ServicePrincipal`, with `sourceArn` or `sourceAccount`) or an organization (`iam.OrganizationPrincipal`). |
|
|
3758
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionPermission.property.endpoint">endpoint</a></code> | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint">WebFunctionEndpoint</a></code> | The endpoint the principal may call. |
|
|
3759
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionPermission.property.sourceAccount">sourceAccount</a></code> | <code>string</code> | For an AWS service: the account that owns the resource calling on its behalf (condition `aws:SourceAccount`). |
|
|
3760
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionPermission.property.sourceArn">sourceArn</a></code> | <code>string</code> | For an AWS service: the ARN of the resource calling on its behalf (condition `aws:SourceArn`, `ArnLike`), e.g. a CloudFront distribution. Without it or `sourceAccount`, any account's use of the service could call the endpoint. |
|
|
3761
|
+
|
|
3762
|
+
---
|
|
3763
|
+
|
|
3764
|
+
##### `principal`<sup>Required</sup> <a name="principal" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionPermission.property.principal"></a>
|
|
3765
|
+
|
|
3766
|
+
```typescript
|
|
3767
|
+
public readonly principal: IPrincipal;
|
|
3768
|
+
```
|
|
3769
|
+
|
|
3770
|
+
- *Type:* aws-cdk-lib.aws_iam.IPrincipal
|
|
3771
|
+
|
|
3772
|
+
Who may call: an account (`iam.AccountPrincipal`), a role or user (`iam.ArnPrincipal`), an AWS service (`iam.ServicePrincipal`, with `sourceArn` or `sourceAccount`) or an organization (`iam.OrganizationPrincipal`).
|
|
3773
|
+
|
|
3774
|
+
A principal in another account also needs `lambda:InvokeWebFunctionEndpoint` in its own IAM policy.
|
|
3775
|
+
|
|
3776
|
+
---
|
|
3777
|
+
|
|
3778
|
+
##### `endpoint`<sup>Optional</sup> <a name="endpoint" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionPermission.property.endpoint"></a>
|
|
3779
|
+
|
|
3780
|
+
```typescript
|
|
3781
|
+
public readonly endpoint: WebFunctionEndpoint;
|
|
3782
|
+
```
|
|
3783
|
+
|
|
3784
|
+
- *Type:* <a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint">WebFunctionEndpoint</a>
|
|
3785
|
+
- *Default:* every endpoint of the function, including ones added later
|
|
3786
|
+
|
|
3787
|
+
The endpoint the principal may call.
|
|
3788
|
+
|
|
3789
|
+
It must belong to this function.
|
|
3790
|
+
|
|
3791
|
+
---
|
|
3792
|
+
|
|
3793
|
+
##### `sourceAccount`<sup>Optional</sup> <a name="sourceAccount" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionPermission.property.sourceAccount"></a>
|
|
3794
|
+
|
|
3795
|
+
```typescript
|
|
3796
|
+
public readonly sourceAccount: string;
|
|
3797
|
+
```
|
|
3798
|
+
|
|
3799
|
+
- *Type:* string
|
|
3800
|
+
- *Default:* no condition
|
|
3801
|
+
|
|
3802
|
+
For an AWS service: the account that owns the resource calling on its behalf (condition `aws:SourceAccount`).
|
|
3803
|
+
|
|
3804
|
+
---
|
|
3805
|
+
|
|
3806
|
+
##### `sourceArn`<sup>Optional</sup> <a name="sourceArn" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionPermission.property.sourceArn"></a>
|
|
3807
|
+
|
|
3808
|
+
```typescript
|
|
3809
|
+
public readonly sourceArn: string;
|
|
3810
|
+
```
|
|
3811
|
+
|
|
3812
|
+
- *Type:* string
|
|
3813
|
+
- *Default:* no condition
|
|
3814
|
+
|
|
3815
|
+
For an AWS service: the ARN of the resource calling on its behalf (condition `aws:SourceArn`, `ArnLike`), e.g. a CloudFront distribution. Without it or `sourceAccount`, any account's use of the service could call the endpoint.
|
|
3816
|
+
|
|
3817
|
+
---
|
|
3818
|
+
|
|
3638
3819
|
### WebFunctionProps <a name="WebFunctionProps" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionProps"></a>
|
|
3639
3820
|
|
|
3640
3821
|
Properties for a `WebFunction`.
|
|
@@ -4169,6 +4350,9 @@ Allows `grantee` to call the endpoint (`lambda:InvokeWebFunctionEndpoint`).
|
|
|
4169
4350
|
The grant is on the endpoint's home-region ARN, which IAM evaluates for every region the
|
|
4170
4351
|
endpoint serves from, including a MULTI_REGION global URL.
|
|
4171
4352
|
|
|
4353
|
+
A grantee in the function's account gets an IAM policy statement. Another account or an AWS service also gets
|
|
4354
|
+
a statement in the function's resource policy (not for an imported function's endpoints).
|
|
4355
|
+
|
|
4172
4356
|
###### `grantee`<sup>Required</sup> <a name="grantee" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionGrants.invoke.parameter.grantee"></a>
|
|
4173
4357
|
|
|
4174
4358
|
- *Type:* aws-cdk-lib.aws_iam.IGrantable
|
|
@@ -4182,12 +4366,16 @@ endpoint serves from, including a MULTI_REGION global URL.
|
|
|
4182
4366
|
|
|
4183
4367
|
### IWebFunction <a name="IWebFunction" id="@ashishpandeyone/cdk-lambda-web-function.IWebFunction"></a>
|
|
4184
4368
|
|
|
4185
|
-
- *Extends:* aws-cdk-lib.IResource, aws-cdk-lib.interfaces.aws_lambda.IWebFunctionRef
|
|
4369
|
+
- *Extends:* aws-cdk-lib.IResource, aws-cdk-lib.interfaces.aws_lambda.IWebFunctionRef, aws-cdk-lib.aws_iam.IResourceWithPolicy
|
|
4186
4370
|
|
|
4187
4371
|
- *Implemented By:* <a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction">NodejsWebFunction</a>, <a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunction">WebFunction</a>, <a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionBase">WebFunctionBase</a>, <a href="#@ashishpandeyone/cdk-lambda-web-function.IWebFunction">IWebFunction</a>
|
|
4188
4372
|
|
|
4189
4373
|
A Lambda Web Function, created in this app (`WebFunction`) or imported (`WebFunction.fromWebFunctionArn`).
|
|
4190
4374
|
|
|
4375
|
+
`addToResourcePolicy` adds to the function's resource policy (who else may call or manage it). A `WebFunction` has
|
|
4376
|
+
one, created by its stack on the first statement. An imported function's policy belongs to the stack that created
|
|
4377
|
+
it, so the statement isn't added (`statementAdded: false`).
|
|
4378
|
+
|
|
4191
4379
|
#### Methods <a name="Methods" id="Methods"></a>
|
|
4192
4380
|
|
|
4193
4381
|
| **Name** | **Description** |
|
|
@@ -4212,7 +4400,9 @@ Allows `grantee` to call the function's endpoint (`lambda:InvokeWebFunctionEndpo
|
|
|
4212
4400
|
|
|
4213
4401
|
for an imported function, the endpoint named in its attributes, or every endpoint.
|
|
4214
4402
|
|
|
4215
|
-
|
|
4403
|
+
For a `WebFunction`, a grantee in this account gets an IAM policy statement; another account or an AWS service
|
|
4404
|
+
also gets a statement in the function's resource policy. For an imported function, only the grantee's IAM policy
|
|
4405
|
+
changes: across accounts, the function's own resource policy must also allow the grantee.
|
|
4216
4406
|
[disable-awslint:no-grants]
|
|
4217
4407
|
|
|
4218
4408
|
###### `grantee`<sup>Required</sup> <a name="grantee" id="@ashishpandeyone/cdk-lambda-web-function.IWebFunction.grantInvoke.parameter.grantee"></a>
|
package/README.md
CHANGED
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
|
|
17
17
|
<!--END STABILITY BANNER-->
|
|
18
18
|
|
|
19
|
-
[AWS Lambda Web Functions](https://aws.amazon.com/lambda/) run an ordinary Node.js HTTP server (Express, Fastify, Hono, `node:http`) on Lambda and give it an HTTPS endpoint, optionally served from several regions. `WebFunction` deploys one, following the conventions of `aws-cdk-lib/aws-lambda` where the two services overlap.
|
|
19
|
+
[AWS Lambda Web Functions](https://docs.aws.amazon.com/lambda/latest/dg/web-functions.html) run an ordinary Node.js HTTP server (Express, Fastify, Hono, `node:http`) on Lambda and give it an HTTPS endpoint, optionally served from several regions. `WebFunction` deploys one, following the conventions of `aws-cdk-lib/aws-lambda` where the two services overlap.
|
|
20
20
|
|
|
21
21
|
```ts fixture=bare
|
|
22
22
|
import * as lambda from 'aws-cdk-lib/aws-lambda';
|
|
@@ -37,10 +37,18 @@ new CfnOutput(this, 'Url', { value: fn.endpoint.url }); // https://<id>.lambda-w
|
|
|
37
37
|
|
|
38
38
|
The stack's region is the function's **home region**. Multi-region endpoints need a stack with an explicit `env.region`.
|
|
39
39
|
|
|
40
|
+
## Installation
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
npm install @ashishpandeyone/cdk-lambda-web-function
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
It needs `aws-cdk-lib` 2.273.0 or later and `constructs` 10.5.1 or later (peer dependencies), and Node.js 22 or later. The package is published for TypeScript and JavaScript only.
|
|
47
|
+
|
|
40
48
|
## Writing the server
|
|
41
49
|
|
|
42
50
|
1. Listen on the host and port in **`AWS_LAMBDA_HTTP_ENDPOINT`** (`0.0.0.0:3000` today). `PORT` is not set.
|
|
43
|
-
2. Start listening within **
|
|
51
|
+
2. Start listening within **10 seconds**, or initialisation fails with `Application.TimeoutListenError`.
|
|
44
52
|
3. Put the entry file at the root of your bundle as **`index.js`**, or set `entrypoint`.
|
|
45
53
|
4. The runtime has **no AWS SDK**: bundle the clients you import.
|
|
46
54
|
5. Code runs on **arm64**.
|
|
@@ -148,6 +156,7 @@ import { SignatureV4a } from '@smithy/signature-v4a';
|
|
|
148
156
|
import { Sha256 } from '@aws-crypto/sha256-js';
|
|
149
157
|
import { fromNodeProviderChain } from '@aws-sdk/credential-providers';
|
|
150
158
|
|
|
159
|
+
const host = new URL(url).hostname; // url: the endpoint's URL
|
|
151
160
|
const signer = new SignatureV4a({ service: 'lambda', region: '*', sha256: Sha256, credentials: fromNodeProviderChain() });
|
|
152
161
|
const signed = await signer.sign(
|
|
153
162
|
{ method: 'GET', protocol: 'https:', hostname: host, path: '/', headers: { host } },
|
|
@@ -156,6 +165,32 @@ const signed = await signer.sign(
|
|
|
156
165
|
const response = await fetch(`https://${host}/`, { headers: signed.headers });
|
|
157
166
|
```
|
|
158
167
|
|
|
168
|
+
### Other accounts and AWS services
|
|
169
|
+
|
|
170
|
+
A caller in another account needs permission twice: in its own IAM policy, and in the function's **resource policy**. `grantInvoke` handles the function's side: a role in the function's account only gets an IAM policy statement, while a principal in another account or an AWS service also gets a statement in the resource policy.
|
|
171
|
+
|
|
172
|
+
```ts
|
|
173
|
+
fn.grantInvoke(iam.Role.fromRoleArn(this, 'Partner', 'arn:aws:iam::444455556666:role/caller'));
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
For principals you can't grant to (a whole account, an organization, an AWS service with conditions), use `addPermission`. The `id` becomes the statement's `Sid`:
|
|
177
|
+
|
|
178
|
+
```ts
|
|
179
|
+
fn.addPermission('PartnerAccount', { principal: new iam.AccountPrincipal('444455556666') });
|
|
180
|
+
fn.addPermission('MyOrg', { principal: new iam.OrganizationPrincipal('o-a1b2c3d4e5'), endpoint: fn.endpoint });
|
|
181
|
+
fn.addPermission('Cdn', {
|
|
182
|
+
principal: new iam.ServicePrincipal('cloudfront.amazonaws.com'),
|
|
183
|
+
sourceArn: `arn:aws:cloudfront::${this.account}:distribution/EDFDVBD6EXAMPLE`,
|
|
184
|
+
});
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
`addPermission` allows calling every endpoint unless you pass `endpoint`. For other actions, such as letting another account create revisions, use `fn.addToResourcePolicy(statement)`. Statements use the endpoint ARN for invoking and the function ARN for actions on the function.
|
|
188
|
+
|
|
189
|
+
- **One resource policy per function, written by the function's stack.** The construct creates it (`AWS::Lambda::ResourcePolicy`) with the first statement. CloudFormation can't attach a second one: another stack, or a `CfnResourcePolicy` of your own on the function, fails at change-set validation with "already exists". If you attached one yourself, move its statements into `addPermission` or `addToResourcePolicy`. Each update of the policy replaces any statements added outside CloudFormation.
|
|
190
|
+
- **Public policies are rejected.** Lambda refuses a policy that lets anyone call the function, and the construct fails synthesis first. A `*` principal is only accepted with a condition that pins the caller, such as `aws:PrincipalOrgID` (`iam.OrganizationPrincipal`) or `aws:SourceAccount`. For a public endpoint, use `authType: NONE`.
|
|
191
|
+
- **Scope AWS services to your resource.** Lambda accepts a service principal with no condition, which would let that service call the endpoint on behalf of any account. The construct warns unless you give `sourceArn` or `sourceAccount` (or an `aws:SourceArn`, `aws:SourceAccount`, `aws:SourceOrgID` or `aws:SourceOrgPaths` condition).
|
|
192
|
+
- Lambda copies the policy to every region the function's endpoints serve from. The copy is eventually consistent, and in tests changes applied in every region within seconds.
|
|
193
|
+
|
|
159
194
|
### Functions defined elsewhere
|
|
160
195
|
|
|
161
196
|
Import a Web Function defined in another stack or app to grant access to it, read its metrics, or reference its revisions:
|
|
@@ -173,7 +208,7 @@ live.metricConcurrentRequests().createAlarm(this, 'Busy', { threshold: 60, evalu
|
|
|
173
208
|
|
|
174
209
|
An imported function's metrics default to its own region. Its endpoints, revisions and log groups stay with the stack that defines it.
|
|
175
210
|
|
|
176
|
-
`grantInvoke` adds to the caller's IAM policy, which is all a caller in the function's account needs. A caller in another account also needs the function's resource policy to allow it, which
|
|
211
|
+
An imported function's `grantInvoke` adds to the caller's IAM policy only, which is all a caller in the function's account needs. A caller in another account also needs the function's resource policy to allow it, which only the function's own stack can change: `addToResourcePolicy` on an imported function adds nothing and warns.
|
|
177
212
|
|
|
178
213
|
## Configuration
|
|
179
214
|
|
|
@@ -194,6 +229,7 @@ api.addEnvironment('FEATURE_FLAG', 'on');
|
|
|
194
229
|
table.grantReadWriteData(api); // the default role trusts lambda.amazonaws.com
|
|
195
230
|
```
|
|
196
231
|
|
|
232
|
+
- **Each execution environment has 2 vCPUs and 2 GB of memory.** There's no memory setting as on Lambda functions; scale with `maxConcurrencyPerEnvironment` and more environments instead.
|
|
197
233
|
- Requests handled by one environment share module-level state, so keep handlers concurrency-safe.
|
|
198
234
|
- Environment variable names starting with `AWS_` are reserved.
|
|
199
235
|
- **Renaming the function replaces it and changes its URL.** A generated name depends on the construct path, so moving the construct renames it too.
|
|
@@ -228,7 +264,7 @@ new NodejsWebFunction(this, 'Api', {
|
|
|
228
264
|
|
|
229
265
|
Lambda Web Functions download code as the `lambda.amazonaws.com` service principal, from a **versioned** bucket, and the CDK bootstrap bucket allows neither. So each stack gets a small code bucket, and the code is copied into it on deploy. The bucket is emptied and deleted with the stack.
|
|
230
266
|
|
|
231
|
-
|
|
267
|
+
Copying code, managing the function's log groups in every region, looking up regional URLs, cleaning up old revisions, creating rollback alarms in other regions and emptying the code bucket all run in one custom resource Lambda per stack. Its logs go to a log group the stack owns, kept for a month and deleted with the stack.
|
|
232
268
|
|
|
233
269
|
## Revisions
|
|
234
270
|
|
|
@@ -364,7 +400,7 @@ Web Functions log in two tiers:
|
|
|
364
400
|
└──────────────────┘ └──────────────────────────────────────────┘
|
|
365
401
|
```
|
|
366
402
|
|
|
367
|
-
**Query `fn.logGroup`**, the home-region group that receives every region's logs. The service would create missing groups without retention and never delete them, so the construct creates and owns all of them: both home-region groups, and `<group>.local` in every other region of
|
|
403
|
+
**Query `fn.logGroup`**, the home-region group that receives every region's logs. The service would create missing groups without retention and never delete them, so the construct creates and owns all of them: both home-region groups, and `<group>.local` in every other region any of its endpoints serves from.
|
|
368
404
|
|
|
369
405
|
```ts
|
|
370
406
|
new WebFunction(this, 'Api', {
|
|
@@ -385,8 +421,9 @@ new WebFunction(this, 'Api', {
|
|
|
385
421
|
|
|
386
422
|
## Limitations
|
|
387
423
|
|
|
388
|
-
- Not yet supported: VPC access (network connectors),
|
|
389
|
-
- `cdk deploy --hotswap` and `cdk watch`
|
|
424
|
+
- Not yet supported: VPC access (network connectors), KMS encryption, tracing, and a CloudFront origin.
|
|
425
|
+
- **Hotswap skips Web Functions without a warning.** `cdk deploy --hotswap` and `cdk watch`, which hotswaps by default, report `(no changes)` for a code or configuration change and the endpoint keeps serving the old revision. Use `cdk watch --hotswap-fallback` (or `cdk deploy --hotswap-fallback`): it deploys Web Function changes through CloudFormation, in about 40 seconds for a home-region endpoint.
|
|
426
|
+
- Fixed limits: 512 MB of code (unzipped) and 32 KB of environment variables per revision, 512 MB of `/tmp` per execution environment, and 128 KiB of headers per request.
|
|
390
427
|
- Quotas: 10 endpoints and about 50 revisions per function (Lambda cleans up older revisions automatically), and 10,000 requests per second per endpoint. Per account and region: 100,000 requests per second and 2,000 Arm64 vCPUs (each execution environment uses 2). The account quotas are adjustable, and new accounts start lower. See [Lambda quotas](https://docs.aws.amazon.com/lambda/latest/dg/gettingstarted-limits.html).
|
|
391
428
|
|
|
392
429
|
## Development
|
|
@@ -49,7 +49,7 @@ const web_function_1 = require("./web-function");
|
|
|
49
49
|
* bundle, and `NODE_OPTIONS=--enable-source-maps` when source maps are on.
|
|
50
50
|
*/
|
|
51
51
|
class NodejsWebFunction extends web_function_1.WebFunction {
|
|
52
|
-
static [JSII_RTTI_SYMBOL_1] = { fqn: "@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction", version: "0.1.
|
|
52
|
+
static [JSII_RTTI_SYMBOL_1] = { fqn: "@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction", version: "0.1.5" };
|
|
53
53
|
constructor(scope, id, props) {
|
|
54
54
|
const runtime = props.runtime ?? lambda.Runtime.NODEJS_24_X;
|
|
55
55
|
const entry = (0, bundling_1.resolveEntry)(props.entry);
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Checks on a Web Function's resource policy, run at synthesis on the resolved document.
|
|
3
|
+
*
|
|
4
|
+
* Lambda rejects a public policy at deploy time ("Lambda blocked the creation of this policy because it would grant
|
|
5
|
+
* public access"): a `*` principal is only accepted when a trusted condition key pins the caller. A service principal
|
|
6
|
+
* without a source condition is accepted, but lets any account's use of that service call the endpoint.
|
|
7
|
+
*/
|
|
8
|
+
export interface ResourcePolicyFindings {
|
|
9
|
+
/** Statements Lambda would reject as public. */
|
|
10
|
+
readonly errors: string[];
|
|
11
|
+
/** Service principals allowed without a source condition. */
|
|
12
|
+
readonly unscopedServices: string[];
|
|
13
|
+
}
|
|
14
|
+
/** Inspects a resolved policy document (`{ Statement: [...] }`). */
|
|
15
|
+
export declare function inspectResourcePolicy(document: any): ResourcePolicyFindings;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Checks on a Web Function's resource policy, run at synthesis on the resolved document.
|
|
4
|
+
*
|
|
5
|
+
* Lambda rejects a public policy at deploy time ("Lambda blocked the creation of this policy because it would grant
|
|
6
|
+
* public access"): a `*` principal is only accepted when a trusted condition key pins the caller. A service principal
|
|
7
|
+
* without a source condition is accepted, but lets any account's use of that service call the endpoint.
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.inspectResourcePolicy = inspectResourcePolicy;
|
|
11
|
+
/** Condition keys Lambda accepts to make a `*` principal non-public (Lambda Web Function permissions docs, 2026-10). */
|
|
12
|
+
const TRUSTED_KEYS = [
|
|
13
|
+
'aws:PrincipalAccount', 'aws:PrincipalArn', 'aws:PrincipalOrgID', 'aws:PrincipalOrgPaths', 'aws:SourceAccount', 'aws:SourceArn',
|
|
14
|
+
'aws:SourceOrgID', 'aws:SourceOrgPaths', 'aws:SourceVpc', 'aws:SourceVpcArn', 'aws:SourceVpce', 'aws:VpceAccount', 'aws:VpceOrgID',
|
|
15
|
+
'aws:VpceOrgPaths', 'aws:Ec2InstanceSourceVpc', 'aws:UserId', 'aws:PrincipalServiceName', 'aws:PrincipalServiceNamesList',
|
|
16
|
+
'aws:PrincipalIsAWSService', 'lambda:SourceFunctionArn',
|
|
17
|
+
].map((k) => k.toLowerCase());
|
|
18
|
+
/** Condition keys that tie a service principal to the resource or account calling on its behalf. */
|
|
19
|
+
const SOURCE_KEYS = ['aws:SourceArn', 'aws:SourceAccount', 'aws:SourceOrgID', 'aws:SourceOrgPaths'].map((k) => k.toLowerCase());
|
|
20
|
+
/** Inspects a resolved policy document (`{ Statement: [...] }`). */
|
|
21
|
+
function inspectResourcePolicy(document) {
|
|
22
|
+
const errors = [];
|
|
23
|
+
const unscopedServices = [];
|
|
24
|
+
for (const [i, s] of (document?.Statement ?? []).entries()) {
|
|
25
|
+
if (s.Effect !== 'Allow')
|
|
26
|
+
continue;
|
|
27
|
+
const keys = conditionKeys(s.Condition);
|
|
28
|
+
const name = s.Sid ? `statement '${s.Sid}'` : `statement ${i + 1}`;
|
|
29
|
+
if (isWildcard(s.Principal) && !keys.some((k) => TRUSTED_KEYS.includes(k))) {
|
|
30
|
+
errors.push(`${name} allows principal '*': Lambda rejects public resource policies. Pin the caller with a condition such as aws:PrincipalOrgID or aws:SourceAccount (e.g. iam.OrganizationPrincipal), or name the accounts`);
|
|
31
|
+
}
|
|
32
|
+
const services = list(s.Principal?.Service).map(String);
|
|
33
|
+
if (services.length > 0 && !keys.some((k) => SOURCE_KEYS.includes(k))) {
|
|
34
|
+
unscopedServices.push(...services);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
return { errors, unscopedServices };
|
|
38
|
+
}
|
|
39
|
+
function isWildcard(principal) {
|
|
40
|
+
return principal === '*' || list(principal?.AWS).includes('*');
|
|
41
|
+
}
|
|
42
|
+
function conditionKeys(condition) {
|
|
43
|
+
return Object.values(condition ?? {}).flatMap((byKey) => Object.keys(byKey ?? {})).map((k) => k.toLowerCase());
|
|
44
|
+
}
|
|
45
|
+
function list(value) {
|
|
46
|
+
return value === undefined ? [] : Array.isArray(value) ? value : [value];
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicmVzb3VyY2UtcG9saWN5LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL3ByaXZhdGUvcmVzb3VyY2UtcG9saWN5LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQTs7Ozs7O0dBTUc7O0FBcUJILHNEQWdCQztBQW5DRCx3SEFBd0g7QUFDeEgsTUFBTSxZQUFZLEdBQUc7SUFDbkIsc0JBQXNCLEVBQUUsa0JBQWtCLEVBQUUsb0JBQW9CLEVBQUUsdUJBQXVCLEVBQUUsbUJBQW1CLEVBQUUsZUFBZTtJQUMvSCxpQkFBaUIsRUFBRSxvQkFBb0IsRUFBRSxlQUFlLEVBQUUsa0JBQWtCLEVBQUUsZ0JBQWdCLEVBQ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0dXJuIHZhbHVlID09PSB1bmRlZmluZWQgPyBbXSA6IEFycmF5LmlzQXJyYXkodmFsdWUpID8gdmFsdWUgOiBbdmFsdWVdO1xufVxuIl19
|
|
@@ -11,7 +11,7 @@ const MAX_STEPS = 20;
|
|
|
11
11
|
* How an endpoint moves its traffic to a new revision.
|
|
12
12
|
*/
|
|
13
13
|
class WebFunctionDeployment {
|
|
14
|
-
static [JSII_RTTI_SYMBOL_1] = { fqn: "@ashishpandeyone/cdk-lambda-web-function.WebFunctionDeployment", version: "0.1.
|
|
14
|
+
static [JSII_RTTI_SYMBOL_1] = { fqn: "@ashishpandeyone/cdk-lambda-web-function.WebFunctionDeployment", version: "0.1.5" };
|
|
15
15
|
/**
|
|
16
16
|
* All traffic moves to the new revision at once, as soon as it's ready (the default).
|
|
17
17
|
*/
|