AWS Amplify hosting vs building

January 2, 2024

Estimated Read time: ~4 min

Intro on AWS Amplify

    AWS Amplify is an all-in-one easy build service for launching web applications utilizing AWS infrastructure. Amplify offers a streamlined process for getting up and running fast, but also has limited features and limited connectivity with other AWS services. The best use case for Amplify is simple front-end applications or creating a proof of concept prototype. In some ways Amplify is similar to AWS Elastic Beanstalk except that Amplify is tailored towards building specifically web based applications, whereas Elastic Beanstalk can build a much wider range of applications. There are two main way of interacting with Amplify. Hosting an application and building an application. Let's take a deeper look into each of them and start to understand the use cases and tradeoffs for each of them.

Hosting an application

    Hosting an application is the more simple of the two processes offered by Amplify. Hosting an application works best with front-end only, single page apps, or static websites. By creating a connection between Amplify and your code repository service of choice, Amplify can automatically detect changes and launch an updated version of the application. Once connected and built, you get a fully deployed version of your app using an AWS temporary URL to view from. Later if you need to attach a permanent domain name, the process is very easy if the domain is hosted through the Route 53 service. There are a variety of configuration options that are important to consider when hosting a web app. Which branch the application is connected to, whether you want automatic deploys or manual, if you need to setup any environment variables, and if you need to modify any of the build settings.

The build Process

    Amplify has it's own miniature version of a CI/CD build pipeline. New builds can be set to trigger automatically or manually. Amplify has the ability to detech what type of application is being built and auto generate built settings to match the application type. This means that you rarely ever have to customize the build settings section. During the build process, there are three main steps: Provision, build, and deploy. Provision allocates resources if needed. Build is the main step to pay attention to. If the process fails, 90% of the time it will fail during the build phase. On build failures, there a detailed logs section that should guide you on what part of the application failed to build. Just because an application will build fine on your local machine does not always gurantee that it will build correctly on Amplify. Once built, then is deploys to the temp URL or your attached domain name.

amplify build process

Building an application

    Building an application through Amplify is a more complex process used for full-stack applications that want to utilize one or more of the other AWS services such as APIs, databases, authentication, or logging. It is also necessary if your application has backend logic or server side rendering since hosting an application only deals with the front-end parts. One thing to keep in mind when building through Amplify, is that it has the ability to automatically spin up other AWS services. It is important to have an understanding and monitor what Amplify creates and if it will be charging money to the AWS account. You can monitor in cloudFormation what was created from the template that was used. In general, Amplify will use services that fall under the free tier or are very cheap, but it is important to be vigilant and not be caught with any unwanted spend costs. The most common connections to Amplify are DynamoDB for a database service, Cognito for authentication and user management, Cloudwatch for a logging service, and S3 for general item storage. Most all of these connections are created and facilitated through the use of the AWS CLI.

AWS CLI and console

    If you are not already familiar with the AWS CLI, it is a command line interface for interacting specifically with AWS resources, and is a tool that you download and specify commands through the terminal or integrated terminal on your code editior. It is widely used across all of AWS development for interacting with all services in AWS, and is faster and more efficient that using the console. A good tutorial for downloading and explaining how to use the CLI can be found here:

Install and use CLI

AWS CLI documentation

The most useful basic CLI commands used with Amplify are:

    * There is a brand new section within Amplify for working specifically with Next.js apps and creating a base starter project. It would be recommended to use this feature if you are trying to combine a Next.js application with Amplify. Currently the starter project that they setup for you is using Next.js version 13.5.4. Previously before this feature, Next.js applications had a hard time being configured and built on Amplify.

Conclusion

Hopefully this was a good primer into the AWS Amplify service and what it is used for.

Related:

Return to Homepage

created by: Matt Ray