Deploy to Amazon Web Services (AWS)
This tutorial will show you how to deploy your services to your own AWS account using Defang.
Prerequisites
- The Defang CLI
- A Defang Account
- AWS Account Credentials
- A
compose.yamlfile in your project - A Dockerfile in your project or use Railpack
Step 1 - Navigate to your project directory
Head to the folder where your project is located.
$ cd path/to/your/project
Step 2 - Authenticate with AWS
There are many ways to authenticate with your AWS account,
but we recommend using the AWS CLI aws login command to authenticate when
deploying from your local machine. This will create a profile with short-lived
credentials which Defang can use to deploy.
The AWS CLI is not required in order to use the Defang CLI, but it is a convenient way to authenticate with AWS.
Step 3 - Create a stack
Before you deploy, you should create a stack. In this
case, we will create a stack called dev:
$ defang stack create dev
Defang will ask us which region we want to deploy to, and which profile we should use to authenticate.
Step 4 - Deploy
Invoke the following CLI command. Defang will ask you which stack you want to deploy to.
$ defang compose up
Step 5 - Inspect your deployment
Defang will provision resources in your AWS account and deploy your services. You can inspect the resources created in your AWS Dashboard.
For a deeper discussion of the Defang AWS Architecture, including a list of the resources we provision in your account, see our AWS Provider docs.