Of course, those servers won't be named ec2-xx-xx-xx-xx.compute-1.amazonaws.com in the source code. They'll instead have a name like "examplecdn.com". DNS is used to convert the hostname "examplecdn.com" to an IP address, which is what your computer actually connects to. It's like looking up a phone number in an old-school phone book and dialing it.
So how do you get the EC2 name in your netstat output? Well, netstat does something called a reverse DNS lookup. It asks the DNS server to give it a hostname for an IP address. This name does not have to be the same as the "examplecdn.com", it's again just a directory service. For all the big cloud providers, you'll see that this defaults to some hostname based on the cloud provider's name. Under Amazon, it's something under amazonaws.com, (and in fact, the ec2-XX-XX-XX-XX should correspond to the IP of the host), and under Google Cloud it's "googleusercontent.com".
So, in summary, what you're seeing is that some resource requested by your computer is hosted by someone using AWS as their service provider. It's not inherently suspicious.