Over 10 years we helping companies reach their financial and branding goals. Onum is a values-driven SEO agency dedicated.

CONTACTS
Cloud Native XOps

Developing Serverless applications with AWS Amplify

What is Amplify?

AWS Amplify is a set of tools that can be used by front-end developers to build full-stack applications on AWS. This greatly reduces human effort to create a mobile/web backend and visually create a frontend UI abstracting most of the cloud services making it easy for frontend developers with little Cloud experience.

Below diagram from AWS depicts an indicative Serverless web application created by Amplify and how Amplify plays different roles in creating and deploying this application.

Core components of Amplify

  • Amplify CLI : Provides a guided tools to configure a application backend from a desktop
  • Amplify Studio : Provides a visual interface for creating backend resources
  • Amplify Libraries: Amplify provides iOS, JavaScript, Android, Flutter based libraries to integrate user interface with application backends.
  • Amplify Hosting: Host your front-end web app, create/delete backend environments, setup CI/CD on the front end and backend, and access Amplify Studio to configure your backend and manage app content and users.
  • Amplify supports the common SPA frameworks like React, Angular, Vue.js, Ionic, and Ember, as well as static site generators like Gatsby, Eleventy, Hugo, VuePress, and Jekyll.
  • Release Management: Manage production and staging environments for your frontend and backend by connecting new branches.

Supported AWS Backends

Amplify provides seamless integration with below AWS services to accelerate backend development.

  • Authentication: Authentication is powered by Amazon Cognito that makes it easy to develop authentication flows using social providers such as Facebook, Google and Amazon and provides fine grained access control to mobile and web applications.
  • Storage: Integrates with S3 to store user generated content like photos , videos and DynamoDB to store application data. Also provides a on-device persistent storage engine that automatically synchronizes data between mobile/web apps and DynamoDB facilitated by AWS AppSync (GraphQL API).
  • API: Frontends can be integrated with AWS backends using with REST API (Amazon API Gateway) and GraphQL API (AWS AppSync)
  • Functions: Lambda function can be added to Amplify project and can be invoked from frontends using an API.

Amplify also supports Analytics (Powered by Amazon Pinpoint and Amazon Kinesis) to analyze user application usage. Amplify also supports Push notifications, publish-subscribe of messages, predictions, conversational bots and location-aware capabilities.

Considerations for choosing Amplify

AWS Amplify is ideal for small Serverless applications developed using AWS services especially using Amazon Cognito, Amazon DynamoDB, AWS AppSync, Amazon API Gateway and S3. Amplify may not fit if the application is very big and uses any non-AWS service as the backend.

Working with Amplify using Amplify CLI

Below “amplify cli” commands can be used from from a command line utility to create create and deploy applications.

#Installing Amplify CLI 
npm install -g @aws-amplify/cli
#Configure login for Amplify
amplify configure
#Initiate Amplify - from the root of the project directory
amplify init 
#Add Amplify components to the application
amplify add
#Add authentication - creates a Cognito user pool 
amplify add auth
#Add Lambda function
amplify add function
#Add GraphQL (AppySync) API or APIGateway API
amplify add API
#Add S3 storage (for storing files) or DynamoDB table
amplify add storage  
#Create/update AWS resources that are configured
amplify push 

Managing DevOps using Amplify

AWS Amplify streamlines the DevOps process by providing an integrated suite of tools that enable rapid development, deployment, and monitoring of serverless applications. One of the standout features is Amplify Console, which offers continuous deployment and hosting services tailored for modern web applications. With Amplify Console, developers can connect their Git repositories, and every code commit triggers an automatic build and deployment process, ensuring that the latest features and bug fixes are promptly available to users. This CI/CD pipeline is fully managed by AWS, reducing the overhead and complexity associated with setting up and maintaining custom pipelines.

In addition to CI/CD, AWS Amplify enhances collaboration among development teams through its seamless integration with AWS CloudFormation. This allows teams to define and manage infrastructure as code, ensuring consistent and reproducible environments across different stages of development and production. Amplify’s support for multiple environments enables developers to work on features in isolated environments, test them thoroughly, and merge them confidently into the main branch. Furthermore, Amplify provides comprehensive monitoring and logging capabilities through AWS CloudWatch, enabling teams to track application performance, detect issues early, and ensure smooth operation. By leveraging these DevOps capabilities, AWS Amplify helps teams deliver high-quality serverless applications with greater efficiency and reliability. Below ate some high-level steps to create DevOps pipline for an amplify project.

Steps to Manage DevOps Pipeline Using AWS Amplify

  1. Connect Your Repository:
    • Begin by linking your Git repository (GitHub, GitLab, Bitbucket, or AWS CodeCommit) to AWS Amplify. This connection is the foundation for setting up your continuous integration and continuous deployment (CI/CD) pipeline.
  2. Configure Build Settings:
    • AWS Amplify automatically detects your project settings, but you can customize your build settings using the amplify.yml file. This file allows you to define build and test commands, environment variables, and post-build steps.
  3. Set Up Environment Variables:
    • Define environment variables directly in the Amplify Console for different environments (development, staging, production). These variables can include API keys, secrets, and other configuration settings necessary for your application.
  4. Enable Automated Builds and Deployments:
    • Once your repository is connected and build settings are configured, Amplify will trigger automated builds and deployments on every code commit. This ensures that your application is always up-to-date with the latest changes.
  5. Manage Multiple Environments:
    • Use Amplify’s support for multiple environments to create and manage separate branches for development, staging, and production. This allows you to test features in isolation before merging them into the main branch.
  6. Monitor and Debug:
    • Utilize AWS CloudWatch to monitor the build and deployment process. Amplify provides detailed logs for each build and deployment, helping you to identify and resolve issues quickly.
  7. Implement Testing:
    • Integrate automated testing into your pipeline by adding test commands in the amplify.yml file. This ensures that your code is thoroughly tested before it reaches production, improving overall quality and reliability.
  8. Rollback and Recovery:
    • Amplify Console allows you to quickly rollback to a previous version of your application if a deployment introduces issues. This feature ensures that you can maintain application stability and minimize downtime.
  9. Customize Domain and Hosting:
    • Amplify offers custom domain management, allowing you to associate your application with your own domain name. Amplify also handles SSL certificates automatically, ensuring secure connections for your users.

By following these steps, you can efficiently manage your DevOps pipeline using AWS Amplify, ensuring a seamless workflow from code commit to deployment

References

  1. Amplify Documentation
  2. Amplify Features
  3. Team workflows with Amplify backend environments
  4. Automatic build-time generation of Amplify config
  5. Deploy and host server-side rendered apps with Amplify