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 - Configure your AWS credentials
There are many ways to authenticate with your AWS account. Once you've done that, Defang will look for your AWS credentials in your shell environment and expect to find one of the following credential sets:
- the
AWS_PROFILEenvironment variable, and optionally theAWS_REGIONenvironment variable - or, the
AWS_ACCESS_KEY_ID,AWS_SECRET_ACCESS_KEY, andAWS_REGIONenvironment variables
If you have the AWS CLI installed (which is not required in order to use the Defang CLI), you can verify that you've authenticated to AWS by running aws sts get-caller-identity and see your account ID.
Step 3 - Deploy
Invoke the defang compose up CLI command with the --provider=aws flag or set the DEFANG_PROVIDER=aws environment variable.
For example:
$ defang compose up --provider=aws
Step 4 - 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.