Skip to content

Commit 120d3d6

Browse files
authored
Additional permissions for LambdaURL, closing issue 77
1 parent 2642926 commit 120d3d6

2 files changed

Lines changed: 8 additions & 2 deletions

File tree

lib/image-optimization-stack.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,12 +261,18 @@ export class ImageOptimizationStack extends Stack {
261261
const cfnImageDelivery = imageDelivery.node.defaultChild as CfnDistribution;
262262
cfnImageDelivery.addPropertyOverride(`DistributionConfig.Origins.${(STORE_TRANSFORMED_IMAGES === 'true')?"1":"0"}.OriginAccessControlId`, oac.getAtt("Id"));
263263

264-
imageProcessing.addPermission("AllowCloudFrontServicePrincipal", {
264+
imageProcessing.addPermission("AllowCloudFrontServicePrincipal1", {
265265
principal: new iam.ServicePrincipal("cloudfront.amazonaws.com"),
266266
action: "lambda:InvokeFunctionUrl",
267267
sourceArn: `arn:aws:cloudfront::${this.account}:distribution/${imageDelivery.distributionId}`
268268
})
269269

270+
imageProcessing.addPermission("AllowCloudFrontServicePrincipal2", {
271+
principal: new iam.ServicePrincipal("cloudfront.amazonaws.com"),
272+
action: "lambda:InvokeFunction",
273+
invokedViaFunctionUrl: true
274+
})
275+
270276
new CfnOutput(this, 'ImageDeliveryDomain', {
271277
description: 'Domain name of image delivery',
272278
value: imageDelivery.distributionDomainName

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
"typescript": "~5.3.3"
2323
},
2424
"dependencies": {
25-
"aws-cdk-lib": "2.189.1",
25+
"aws-cdk-lib": "2.227.0",
2626
"constructs": "^10.3.0",
2727
"source-map-support": "^0.5.21"
2828
}

0 commit comments

Comments
 (0)