Cloudfront exports Domain name only - Need ARN #4968
-
After having reviewed the Copilot source code and deploying a test application, it seems Copilot exports the UPDATE: I've just realised this isn't the right way to attach a WAF to Cloudfront:
What would be the right way to attach a WAF to Cloudfront (Load Balanced Web Service) using AWS Copilot? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 5 replies
-
hmm, this looks like a case for Environment overrides and addons. That is, you'll need to define your WebACL in an addons stack in the environment, then amend the AWS::CloudFront::Distribution resource with This is getting a little complicated, so I'll give some partially filled examples. you'll want to configure your web ACL however you like; I've left the properties unfilled. so, as far as I can tell, you'll need to set up the following env addons stack: Parameters:
App:
Type: string
Env:
Type: string
Resources:
WebACL:
Type: AWS::WAFv2::WebACL
Properties:
CaptchaConfig:
CaptchaConfig
ChallengeConfig:
ChallengeConfig
CustomResponseBodies:
Key: Value
DefaultAction:
DefaultAction
Description: String
Name: String
Rules:
- Rule
Scope: String
Tags:
- Tag
TokenDomains:
- String
VisibilityConfig:
VisibilityConfig
Outputs:
WebACLArn:
Value: !GetAtt WebACL.Arn Then, you'll want to run - op: add
path: /Resources/CloudFrontDistribution/Properties/DistributionConfig/WebACLId
value:
Fn::GetAtt:
- AddonsStack
- Outputs.WebACLArn This should wire everything up correctly. the addons stack will get created before the CDN, and it will refer to the Outputs section of the addons stack. I referred to the following resources for this answer: |
Beta Was this translation helpful? Give feedback.
Hello @afgallo. It's probably because the WebACL you specified was not in
us-east-1
required by CloudFront. At this point, I think we can either 1) In env addons stack create a custom resource which calls WAF API to create it inus-east-1
and use its ARN as the physical ID 2) create the WAF inus-east-1
before env deployment.For option 1, we have very similar scenario where we need to replicate an ACM certificate to
us-east-1
.