最新消息:Welcome to the puzzle paradise for programmers! Here, a well-designed puzzle awaits you. From code logic puzzles to algorithmic challenges, each level is closely centered on the programmer's expertise and skills. Whether you're a novice programmer or an experienced tech guru, you'll find your own challenges on this site. In the process of solving puzzles, you can not only exercise your thinking skills, but also deepen your understanding and application of programming knowledge. Come to start this puzzle journey full of wisdom and challenges, with many programmers to compete with each other and show your programming wisdom! Translated with DeepL.com (free version)

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

matteradmin8PV0评论

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

Articles related to this article

Post a comment

comment list (0)

  1. No comments so far