IntroductionHow much time do you spend on your server configuration? Amplify connects a
backend to a web or mobile application in a few minutes, deploys static web applications,
and manages the content or users in the AWS console easily. This blog explores the philosophy
behind AWS Amplify, the relationship with serverless, the setup,
features, and the multiple uses.
Amplify has two main components.
The CLI which is probably the component that a developer is going to use more frequently. Amplify has an admin UI that simplifies the backend setup with a visual point-and-click experience that works seamlessly with the Amplify CLI. The admin UI also includes functionality for managing app content and users.
So, Amplify exists based on the concept of serverless.
Serverless is one of those concepts that has been gaining popularity in the last decade.
It has been searched by more people around the world in the last five years,
and the reason for that is because it is a model that is sometimes misunderstood.
On the web, there is a lot of information about serverless. It is most frequently
defined as a model where there are no servers, and the application's code runs
like magic which is not technically correct.
Serverless is a cloud computing execution model in which the cloud provider allocates machine resources on-demand, taking care of the servers on behalf of their customers.
Developers focus only on the code, and they do not need to manage the server tasks such as capacity planning, configuration, management, maintenance, operation, or scaling. AWS has products such as Lambda, DynamoDB, S3, API Gateway, all of them could be used to create systems based on the serverless architecture.
The first step to use Amplify is to have an AWS account. Then, install the Amplify CLI via NPM, remember that NodeJS needs to be installed.
The CLI provides a way to interact with the AWS APIs. These are used to create the backend for the application. The following steps allow to set up and use the Amplify environment
Commands like Amplify status will list all the Amplify resources data configured
in the project to know if it is needed to run the command Amplify push again to sync
the AWS resources. Also, this command will allow team members to keep in sync with new
backend resources added to the project.
Amplify uses the CloudFormation AWS tool to create infrastructure as code, which could be described as a template in YAML or JSON files. The advantages of these approaches are:
MultiplatformThe CLI is supported on macOS, Linux, and Windows, and the Amplify Framework
is supported on React, Vue js, plain Javascript, iOS, Android, and Flutter.
HostingAWS Amplify offers a fully managed service for deploying and hosting static
or single-page web applications, and it is pretty straightforward to set up too.
It can be set up, so that when the code is merged on the Git repository,
the website will be also updated. The Git platforms supported are Github, BitBucket,
Gitlab, and AWS CodeCommit.
The Amplify philosophy is “do more with less”, but to understand how Amplify can scale and how it works among teams, it is necessary to know how Amplify modules work under the hood. Some of them use Amazon Cognito for Authentication, S3 for storage, Lambda for functions, API Gateway, and App Sync for the API section among others.
Amplify init command
Creates an Amplify directory inside of the root application path where the backend resources will live.
Amplify add API command
Adds a graphQL API using AWS Appsync or rest APIs backed by API Gateway, then the CLI will update the cloud formation - template.json file, and it will add the resources to it. This is the way that CloudFormation works.
Amplify add auth command
Automates the access control policies for the resources protecting the data in the APIs using AWS Cognito. Cognito is a robust user directory service that handles user registration, authentication, account recovery, and other operations. It can be integrated with Facebook and Google. Besides, Amplify has prebuilt UI elements such as user registration, login, and password recovery.
Amplify add storage
Depending on the content to store. CLI will use S3 to save files or it will create a NoSQL database using DynamoDB. The storage is backed by Amazon S3, which is a service to save data on public or private buckets.
Locations
USA
Mexico
Colombia
Contact
+01 (925) 951-8681
+52 (477) 104-3350
info@cbqasolutions.com