The way we develop software is rapidly and increasingly changing with the world around us. One of the more exciting developments is the advent of serverless technology, which, when applied correctly, opens doors to organizational agility and speed — and thus innovation and happy users.
One of the quickest ways to get familiar with this way of working is using AWS Amplify, a set of powerful tools and features that can help you quickly and easily build cloud-powered, extensible, and scalable full-stack applications.
Amplify has selected a subset of all AWS services and default settings to help you quickly get started with building your Cloud Native application and thus provide value at a higher pace. This might seem like you are losing control over your application and that you will be limited somehow; however, with AWS Amplify, you can still override any defaults and access any AWS service if you need to.
In this blog series I will introduce AWS Amplify, explain why you would want to use it, how it works, and give detailed examples of the several categories of functionality available out-of-the-box with AWS Amplify.
The entire series will cover the following topics:
- What is AWS Amplify?
- How does AWS Amplify work?
- Why should you use AWS Amplify?
- Developing and deploying a Cloud Native application with AWS Amplify
- Uploading and retrieving images with Amplify Storage
- Using the power of AI and Machine Learning with Amplify Predictions
- Track app usage with Amplify Analytics
- Location functionality with Amplify Geo
- Chatbots with Amplify Interactions
- Do everything with AWS Amplify! (Extensibility)
- Low Code with Amplify Studio
We hope you will enjoy this series and extend your AWS Amplify knowledge.
In this blog, we will give a high-level overview of the functionalities and tools provided by Amplify.
With Amplify, we are more concerned with what we want to build instead of how it will work with AWS. Amplify offers the possibility to generate AWS services based on a set of functionality categories. At the moment of writing, these categories are:
- Authentication: Fast and easy authentication and authorization out-of-the-box
- API: Create and use a REST or GraphQL API as a gateway to other services in AWS, such as Lambda functions or databases
- Storage: Used for storing and retrieving user-generated content on AWS such as photos, videos, or other files
- Geo: Location-based functionality such as maps and location search
- Hosting: Hosting your app on AWS and setting up a CI/CD pipeline
- Interactions: Create chatbots for your application
- PubSub: Connectivity with cloud-based message-oriented middleware
- DataStore: Use on-device persistent storage to be able to use your application when offline
- Functions: Create Lambda functions that are linked to an API or create CRON jobs
- Analytics: Add tracking of user behavior of your apps
- AI/ML Predictions: Use AI/ML to add functionality such as text translation, speech-to-text, and entity recognition in images
- Push Notifications: Send messages to your customers to improve engagement
- Extensibility: Leverage any other AWS service that is not covered by the categories above by using AWS CDK
As you can see, the functionality categories already cover many everyday use cases for web and mobile apps while still offering flexibility by leveraging CDK.
AWS Amplify consists of 4 tools that help you develop cloud-native applications. These are:
- CLI: The Command-line interface that you can use to initialize your Amplify project and generate AWS resources
- Libraries/SDK: The set of libraries used by your frontend of any kind to more easily be able to communicate with the AWS resources created with Amplify
- Console: The AWS service where you can keep track of your Amplify projects and configure many settings related to the deployment and hosting of your AWS Amplify app
- Amplify Studio: Amplify Studio allows you to configure your AWS resources using the console and visual modeling. Everything you change here is still compatible with the CLI, and you can even use the CLI to download the resources you designed in the studio.
With the command-line interface (CLI), you can run a few commands, you will be asked specific questions about the functionality you want to achieve, and it will generate the AWS resources based on your answers. Here is an example of such an exchange with the Amplify CLI:
In this example, we add a REST API to my project using the Amplify CLI. Depending on what functionality you want to add, you will need to answer different questions.
In the following blogs in this series, we will be using the CLI a lot and show you everything from starting a project to adding several functionalities. For now, it is important that you have a broad idea of how the CLI works.
We can use the Amplify libraries to connect our app to AWS resources we created using the CLI. There are libraries for all of the most popular frameworks to develop web and mobile apps:
There are helper functions for most functionality categories covered by Amplify that help you use the AWS resources you have created via the CLI.
Just like services such as API Gateway or AWS Lambda, AWS Amplify is can now also be considered a first-class citizen and can be found as a service in the AWS console. Here is an example of what it looks like when you have active projects:
The following is a list of things you can do on the Amplify console:
You can set up a CI/CD pipeline via the Amplify CLI and track the progress via the Amplify Console. Here is a screenshot of what it looks like:
The default CI/CD pipeline setup has these four steps. However, it is fully configurable either in the Amplify console or by adding a .yml file in the root of your Amplify project. If the project builds and is deployed successfully, you will even see a preview of your app, and you will be provided with a link to the hosted app.
You can connect git branches from your projects to an AWS Amplify environment you have created with the Amplify CLI. Once connected, your app can be built every time you push to that branch, and the frontend and backend environment it is related to will be deployed.
By default, you will get a cloudfront.net URL on which your application is hosted when you first start. However, in the Amplify Console, linking a domain you have registered to a specific git branch of your project is possible. In the case shown above, every time something is merged to develop, a build is run, and once it is deployed, it is available at https://cloudthegame.com.
You can change the build steps in the console as previously mentioned. You can configure custom webhooks to trigger builds for specific branches, and you can configure the settings for the Amazon Linux container that will run the build. Setting up environment variables is also possible.
While services created with the Amplify CLI, such as API Gateway and Lambda, have their metrics, the Amplify console shows you metrics related to your hosted application. You can see metrics such as viewer requests, bytes downloaded, and errors.
The Amplify Studio allows you to achieve the same functionality you could using the CLI. The difference is that instead of answering questions in a CLI, you are clicking in the console. You will see that all functionality categories have tabs that you can configure. Once you are done configuring your backend, you can "pull" the backend to your local Amplify project and start using it in your application in the same way you would if you generated the backend using the CLI.
Here is a screenshot of the studio where we designed a data model for our pizza restaurant:
There is also a set of functionalities that is exclusive to the Amplify Studio, such as:
- UI Library: You can make component UI designs in Figma and generate ReactJS component code. You can even link the components to backend logic in the studio
- Data and files: You can manage your database (CMS), files, and user/groups.
- Authentication: You can give users access to your Amplify studio environment without creating an AWS account. This can be useful if you have clients who want to manage the data for their application.
In short, Amplify Studio aims to be a visual development environment. While it is low-code, it is still backed by human-readable code and AWS CloudFormation, the infrastructure-as-code solution on AWS. We will talk more about CloudFormation in the next blog.