The Cloud Era brought the term ‘Serverless’ to life, an approach that allows companies to build and run services without having to manage the underlying infrastructure. As a result more and more businesses choose a serverless architecture for their projects. Read on to discover how, by building a serverless architecture with AWS Amplify we were able to create the social shopping, video-based mobile app, ari, in just 3 months.
One of the biggest challenges for new startups is to build a product and get to the market as quickly as possible. At the start of the ari project there were many ideas and concepts that sounded great but still needed validation and clarification. We wanted to find the best approach that would give us the flexibility = agility, and efficiency we needed to explore and deliver these concepts during a development life cycle. We were looking for a robust set of tools and services that would allow us to focus on the core value proposition of ari, minimizing the time needed in other areas, such as creating our own cloud infrastructure. After researching different cloud-based solutions, we decided to move forward building a serverless architecture using AWS's Amplify framework.
First launched in late 2017, AWS Amplify is an open source platform of tools and services designed to make it easy for developers to create and launch secure, scalable full stack applications, powered by AWS. AWS Amplify includes a wide variety of open-source libraries. It also has a built-in CLI you can use to build your backend.
Let’s have a look at the main features of the Amplify framework.
Applications with sign-up/sign-in functionality require an authentication service. Instead of building your own, many companies rely on existing third-party authentication providers. Amplify has built in support with one such provider, AWS Cognito. With Cognito, you can create seamless on-boarding flows with a fully-managed user directory and pre-built sign-up, sign-in, forgot password, and multi-factor auth workflows. Cognito also supports login with social providers such as Facebook and Google, and allows for customization, which we used to implement passwordless authentication for ari.
The frontend applications call APIs to trigger backend logic, access, manipulate, and combine data from one or more data sources. The Amplify Framework supports Amazon AppSync, a managed service that uses GraphQL to make it easy for applications to get exactly the data they need. There is also an option to select REST as the service type, powered by Amazon API Gateway.
Lambda functions allow you to run code (business logic) without creating and managing your own server. Amplify makes it easy to add functions to your project.
The Storage module provides a simple mechanism for managing user content like videos, images, etc. Application content can be stored in private or public storage folders (buckets), powered by Amazon S3.
AWS Amplify offers a fully managed service for deploying and hosting fullstack web applications, with built-in CI/CD workflows that accelerate your application release cycle.
By using AWS Pinpoint you can tailor your content and communicate through multiple channels including email, texts as well as push notifications. This allows you to improve customer engagement by using marketing and analytics capabilities. Leverage customer insights to segment and target your customers more effectively.
Amazon Sagemaker helps to enhance your app by adding AI/ML capabilities, and easily achieve use cases like text translation, speech generation from text, entity recognition in image, interpretation of text, and transcribing text. Amplify supports advanced use cases like uploading images for automatic training and using GraphQL directives for chaining multiple AI/ML actions.
There’s a lot more too. The list below includes just some of the AWS services that we used with Amplify:
Amplify is completely scalable. You only need to pay for the services you are using to build & deploy your application; e.g., if you’re using S3 for storage and you add an Amplify storage module, you’ll pay just the usual S3 fees.
AWS Amplify’s serverless architecture results in a cloud infrastructure that can manage and scale itself. With this, you can easily take your application from prototype to production.
By using Amplify, your team automatically adopts an ‘Infrastructure as code’ principle. Amplify automatically captures the infrastructure configuration as part of your code. Known as CloudFormation templates in AWS, this ensures your infrastructure services can be easily provisioned. It significantly reduces the time that a developer could need to spend automating this devops process.
Your team will immediately see the benefits of this ‘Infrastructure as Code’ principle. For example, building software requires different environments for development/testing and eventually for public use. Building on top of its powerful provisioning capabilities, Amplify CLI provides a set of commands to provision cloud-based resources in different environments, so developers without a DevOps background can manage environments. For example, if you want to add a new backend environment, you just need to run the commands:
It’s easy to spin up / down services to experiment and build quick proof of concepts for your product team. For example, if want to explore adding social logins, with Amplify CLI you can add the ‘auth’ category to your project:
Then follow the steps to configure it for Google or Facebook credentials.
You can then remove it later with the command
Amplify provides GraphQL directives to enhance your data model with capabilities such as table auto-creation, custom indexes, authorization rules, function triggers, and more. For a new table you just need to add the ‘@model’ directive, and a new table with all predefined APIs will be created to support create/read/update/delete (CRUD) operations. For example, the code for a new table ‘Post’ will look like this:
With AWS Amplify you only pay for what you use. Your costs will only grow when usage (and presumably revenue) increases. Many of it’s services have free tiers, many of which are expanded for the first 12 months.
Amazon offers the AWS Activate program. It is a free program that provides eligible startups with tools and resources, including AWS credits, and AWS Support credits to help startups quickly get started on AWS and grow their business.
With our extensive experience using Amplify, we’ve learned there are still some things to keep in mind when working with this powerful platform.
Overall, using AWS Amplify has been a great experience. It empowers our engineering teams to deliver more value with less cost, getting high quality products to market faster for our clients.
The success of a startup isn’t solely based on the idea alone. It also requires a strategic and successful execution. Choosing the right cloud platform is one of the most important decisions you will have to make, as it impacts costs, agility, productivity, and performance. Our team will be glad to help you choose the right one, just like we did with ari.
Are you ready to take your business idea or product to the next level? Feel free to contact us today: firstname.lastname@example.org