title: Cloudfront with EC2 instance
body: <p>I was able to get Cloudfront working with an S3 instance, but I'm stuck with EC2 (I'm new to AWS). My Go server is accessible via elastic IP on port 443. </p>
  
  <p>When creating the Cloudfront distribution, I used my EC2's public DNS (IPv4) as the Origin, HTTPS only, alternate domain names to the host zones I've defined in Route43, custom SSL certificate from Certificate Manager (which is issued). The status of the Cloudfront distribution is Deployed and State is enabled. </p>
  
  <p>If I try to access the Cloudfront distribution by using the subdomain I've setup, and I simply get "Sever Not Found". If I try to access the Cloudfront distribution using the given Cloudfront domain name, I get "502 ERROR The request could not be satisfied. CloudFront attempted to establish a connection with the origin, but either the attempt failed or the origin closed the connection. "</p>
  
  <p>Are there more steps I'm missing to the process? I thought I could use EC2 as an origin.</p>
  
  <p>DNS with Route43,
  Domain registered through GoDaddy</p>
  
  <p>Cloudfront domain name: d2yxz5aawjiy26.cloudfront.net</p>
  
  <p>Subdomain: api.tranquility.app</p>
  
  <p>Elastic IP: 35.182.112.85 running on port 443</p>
  
  <p>EDIT: If it matters, I'm running docker with the app mapping port 443 to 8080 in docker-compose.</p>
  
  <p>UPDATE: Perhaps something to do with <a href="https://docs.aws.amazon.com/acm/latest/userguide/acm-services.html" rel="nofollow noreferrer">https://docs.aws.amazon.com/acm/latest/userguide/acm-services.html</a> and that I should use a load balancer for my ec2 instance.</p>