Solution 1:

In the past S3 supported FQDN bucket names - i.e. exactly what you needed. Where FQDN = Fully Qualified Domain Name, i.e. full host name like static.mypage.com. The problem is that this only works with HTTP and not with HTTPS because there is no way to make S3 use a SSL certificate with your bucket name / host name (static.mypage.com).

You can still do it if you're happy with HTTP-only traffic. Simply create a static.mypage.com CNAME at your registrar pointing to s3.eu-west-1.amazonaws.com. S3 will recognise the Host: header in the request and look into the right S3 bucket. Provided that the objects in the bucket are publicly accessible the URL http://static.mypage.com/pics/one.jpg should work just fine.

However as soon as you access the same over HTTPS you will get a SSL Certificate Validation error because the hostname in the S3 certificate *.s3.eu-west-1.amazonaws.com won't match the expected static.mysite.com.

The solution is CloudFront which can sit in front of your S3 and handle the right SSL certificate for it:

  1. create a free SSL certificate for static.mysite.com in Amazon Certificate Manager (or upload your 3rd party issued SSL cert to ACM).
  2. set up a CloudFront distribution, attach the SSL cert to it
  3. configure the CloudFront distribution to use your S3 bucket as the Origin
  4. configure a static.mysite.com CNAME at your DNS provider to point to the CF distribution name, e.g. d123456abcdef.cloudfront.net
  5. with that your desired URL https://static.mypage.com/pics/one.jpg should finally work.

Also have a look at Routing traffic to a website that is hosted in an Amazon S3 bucket.

Hope that helps :)

Solution 2:

Logon to your web host control panel and select “Manage DNS Server Settings” or similar Create a new CNAME entry for your domain. For your example of static.mypage.com, the entry is:

Name: static
Type: CNAME
Value: s3-external-3.amazonaws.com.

(If you are an American user, use s3.amazonaws.com. instead) And yes, the dot at the end of “s3-external-3.amazonaws.com.” is correct, for my web host. Look at your other entries to figure out what your should enter for your web host.

See here for more info https://carltonbale.com/how-to-alias-a-domain-name-or-sub-domain-to-amazon-s3/