getlift / lift

Expanding Serverless Framework beyond functions using the AWS CDK
MIT License
920 stars 112 forks source link

Need WAF as an extension to single-page-app #386

Closed ktwbc closed 8 months ago

ktwbc commented 8 months ago

If you are standing up an app, there needs to be a way to add a WAF to it. It could be resource itself that's also created by Lift but at least as a version 1 on new feature, be able to apply an existing WAF to a site being stood up.

ktwbc commented 8 months ago

Ok I did find buried in the PRs how to implement as extension. I'll write here in case someone else needs help:

example includes some other options as well:

constructs: {
    app: {
      type: 'single-page-app',
      path: '../app/dist',
      domain: dnsSettings.host,
      certificate: dnsSettings.certificate,
      extensions: {
        distribution: {
          Properties: {
            DistributionConfig: {
              ViewerCertificate: {
                SslSupportMethod: 'sni-only',
                MinimumProtocolVersion: 'TLSv1.2_2021'
              },
              PriceClass: 'PriceClass_100',
              WebACLId:
                'arn:aws:wafv2:us-east-1:123456789012:global/webacl/myWebACLName/aaaaaaa-bbbb-cccc-dddd-eeeeeeeee'
            }
          }
        }
      }
    }