Amazon Web Services (AWS) is a leading cloud platform trusted by developers and DevOps engineers for deploying scalable applications. If you're a business or developer using FastAPI for your backend and want to deploy to AWS, this guide is for you. In this step-by-step tutorial, you'll learn how to deploy your FastAPI project to AWS seamlessly using PipeOps.
What You Need to Get Started
Before going straight into deployment, ensure you have the following essentials ready:
- Active AWS account
- FastAPI project You can use this PipeOps FastAPI starter kit here to follow along in this tutorial
- PipeOps account
Integrating Amazon Web Services (AWS) with PipeOps
Log in to your PipeOps account and navigate to the dashboard. From the left sidebar, select the Integrations tab. This will take you to a page where you can connect to a cloud provider. Click Amazon Web Services to begin the integration process.
After selecting AWS, you'll be prompted to enter your AWS account ID. This allows PipeOps to request the necessary IAM (Identity and Access Management) permissions.
To get your ID, go to your AWS account and click on your profile name. Doing so will reveal your AWS Account ID, which you'll need for this step.
Click Authorize IAM
Creating a Server on PipeOps
Upon successful authorization via IAM, the next step is to create a server. Select "Provision a Server” from the dropdown as shown below:
Choose “On Cloud” as your deployment method, and click the Next button to customize your server. Select AWS from the list of providers and click Proceed.
Choose your AWS region and click Next.
On the next page, select a configuration method. For this guide, we’ll use Custom Configuration. You can also choose Karpenter for automatic scaling. Click Next to proceed.
On this page, we’ll choose the Dev/Staging environment and General Purpose instance type. You can choose the development environment and instance type that matches your requirements. Once your choices are in place, finalize the process by clicking the "Create Server" button.
Deploying your FastAPI project
To begin deployment, click New Project on your PipeOps dashboard and select "Web".
Select your repository source. For this guide, we’re deploying from GitHub. After that, you can select your account name to access the list of repositories that you own. From there, select your FastAPI project repository to work with and click on proceed.
In the next page, you can define your project name or go with the default. You can also specify your environment. For this guide, we’ll use the default settings.
After clicking Proceed, you’ll be directed to the build settings page. Here, you have the opportunity to make selections regarding the preferred framework, as well as the build method that aligns with your preferences.
We’ll select FastAPI and go with the recommended build method. It’s always best to use the recommended build method when deploying your projects.
Click on the "Deploy Project" button to deploy your application.
Once the deployment is complete, you will see a success message as shown in the image below.
Click Live URL to view your deployed application.
Conclusion
Deploying your FastAPI project on AWS is straightforward using PipeOps. By connecting AWS and PipeOps, you can effortlessly set up a server, link your GitHub repository, and customize deployment settings. This process simplifies cloud deployment, even for those less familiar with DevOps. Through this combined solution, your FastAPI project can be deployed with confidence, ensuring a scalable and reliable backend system.
Notably, you can link a custom domain to your PipeOps Project. Learn how to connect a custom domain to make your app production-ready.