23

I see in aws-cdk there are two constructs:

Each have different props that do not look compatible with each other.

I'm wondering which one to use?

Stoyan Georgiev
  • 345
  • 2
  • 8

2 Answers2

27

The AWS CloudFrontWebDistribution is the original method for working with CloudFront distributions. But now, they had implemented a new method that is provided by Distribution. You can use both CloudFrontWebDistribution as well as Distribution for working with CloudFront distributions, but Distribution has a simpler interface and they receive new features faster. So, it is recommended to use Distribution instead of CloudFrontWebDistribution.

Ankush Chavan
  • 1,043
  • 1
  • 6
  • 20
  • 4
    To support this argument, here is an implementation of Cache Policies in CloudFront Distribution. CloudFrontWebDistribution is pending implementation since Oct 2020 but Distribution got it already implemented and merged. https://github.com/aws/aws-cdk/pull/10656 – Hussain Mansoor May 23 '21 at 10:07
  • 1
    Good to know. Maybe they should mention it in the CDK API documentation. – adonig Dec 25 '22 at 09:59
0

You can use CloudFrontWebDistribution unless you're looking to have RTMP (streaming) distribution then you can configure the Distribution

AWS PS
  • 4,420
  • 1
  • 9
  • 22