Serving Vector Tiles Directly from S3 – Is it Possible?

amazon s3cloud-gistegolatilesvector-tiles

I have seen that it is possible to use S3 as a storage backend for vector tile servers such as Tegola. These work by fetching the tile from S3, then serving it through an application server.

Is there any possible mechanism by which tiles would be fetched directly from S3 in the browser? Having a massively scalable infrastructure like S3 piped through a tiny server seems like a bottleneck to be avoided.

Best Answer

It is possible. I recommend you to use Route 53, S3, CloudFront.

  1. Host your domain name on AWS via AWS Route 53 DNS (yourdomain.com) to create a public zone.
  2. Create a SSL Cert for your domain name via AWS ACM
  3. Create a S3 Bucket (yourdomain.com) with the same domain name and enable website hosting.
  4. Use the S3 Bucket Hosted Name to map into your recently created public zone via Route 53 using A Record with "Yes" for alias target with your S3 Bucket hosted name.
  5. Create a AWS CloudFront Distribution (CDN) with SSL support and put in your domain name in CloudFront's Alternative Domain Names (CNAMEs) section.
  6. You can publish using OSM data with XYZ layer (pbf) or using mbutil by mapbox if you have mbtiles to convert into pbf or using tippecanoe from github.
  7. Upload all the contents of the folder structure of the pbf (Example: /0/0/0.pbf).
  8. Ensure you have .pbf and .json has the respective metadata. (.pbf needs to have gzip and application/x-protobuf while .json only has application/json).