S3 to Amplify

I love AWS. Well, cloud services are all about the same nowadays so I love them all, but I USE AWS like all the time. Maintenance of websites, standing up services, Machine Learning PoCs- I can even control my ground satelitte networks from my bathroom. Indeed a wonderful time to be alive, but sometimes it doesn’t behave as I expect, and this is a brief log of one such adventure.

A few months back I, alongside a rather talented individual, started a consulting company to sharpen skills and help neighbors in our state with their IT needs. BUT you can’t be an IT firm without a sweet website and some fantastic marketing one liners so we knew a website was needed. After much work Thomas was able to create this sweet gradient line graphic and I added a simple contact CTA and greenvariable.com was rolling. Static, deploy to S3 and wipe your hands However, that doesn’t account for any services or enhancements we may need in the future and was always temproary so after a few weeks we started migrating to Amplify.

AWS Amplify is a great tool for developers to get a managebale deploy pipeline created- fast. There are some rather serious concerns about it’s security policies but since none of our websites maintain PII or deal with dolla, dolla bills we believe it is a great tool to leverage for our work.

Everything was going hunky-dorie until I attempted to stand up our custom domain. At the moment most of our sites are not hosted through Route53, primarily to not have all eggs in Papa Bezos Jassy’s basket, and instead we go with Google Domains. This decision, while not uncommon, does require us to take a few different steps to get everything working but it typically fairly painless. Until…

Error message: One or more of the CNAMEs you provided are already associated with a different resource.

To undestand the fix for this error it’s partially important to know how AWS is managing the resources associated with initially creating an S3 bucket to host a static site. Whenever a developer goes through the steps to create a static website that is hosted through AWS in addition to the bucket to hold their site files a CloudFront distribution is generated as well to serve the bucket’s content. The IRL representation of this will be something like https://d111111abcdef8.cloudfront.net and this is what your Domain Registar (the Googs for us) will connect to for traffic routing.

When you delete the S3 bucket your cloudfront distribution is not removed :) So in this case simply diving into our CF services and removing the existing routes resolved the error. A rather simple fix that highlights the importance of understanding the components of your system.