最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

amazon web services - CloudFront function association - Invalid request provided: The function ARN must reference a specific fun

programmeradmin1浏览0评论

I've created an AWS::CloudFront::Function using CloudFormation (template here). Then I've tried to associate with a distribution following the LambdaFunctionAssociation docs:

DistributionConfig:
  DefaultCacheBehavior:
    LambdaFunctionAssociations:
      EventType: viewer-request
      LambdaFunctionARN: !GetAtt Function_Logical_ID.FunctionMetadata.FunctionARN

And I get the following error: Invalid request provided: The function ARN must reference a specific function version. (The ARN must end with the version number.)

How to associate a CloudFront Function using CloudFormation?

I've created an AWS::CloudFront::Function using CloudFormation (template here). Then I've tried to associate with a distribution following the LambdaFunctionAssociation docs:

DistributionConfig:
  DefaultCacheBehavior:
    LambdaFunctionAssociations:
      EventType: viewer-request
      LambdaFunctionARN: !GetAtt Function_Logical_ID.FunctionMetadata.FunctionARN

And I get the following error: Invalid request provided: The function ARN must reference a specific function version. (The ARN must end with the version number.)

How to associate a CloudFront Function using CloudFormation?

Share Improve this question asked Nov 18, 2024 at 21:26 Pedro ArantesPedro Arantes 5,3695 gold badges29 silver badges64 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 1

My mistake was that I was using LambdaFunctionAssociations instead of FunctionAssociations (docs here):

  • FunctionAssociations are for CloudFront functions;
  • LambdaFunctionAssociations are for Lambda@Edge.

Then I changed to the template below and it worked:

DistributionConfig:
  DefaultCacheBehavior:
    FunctionAssociations:
      EventType: viewer-request
      FunctionARN: !GetAtt Function_Logical_ID.FunctionMetadata.FunctionARN

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论