Deploy to Amazon Web Services (AWS)
This tutorial will show you how to deploy your services to your own AWS account using Defang.
Pre-requisites
- A Dockerfile in your project
- A
compose.yaml
file in your project - A Defang Account
- The Defang CLI
- AWS Account Credentials
Step 1 - Navigate to your project directory
Head to the folder where your project is located.
$ cd path/to/your/project
Step 2 - Authenticate Defang to use your AWS Account
There are many ways to authenticate 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_PROFILE
environment variable - or, the
AWS_ACCESS_KEY_ID
andAWS_SECRET_ACCESS_KEY
environment 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.