> For the complete documentation index, see [llms.txt](https://django-cloud.gitbook.io/django-cloud-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://django-cloud.gitbook.io/django-cloud-docs/getting-started/connect-aws.md).

# Connect your AWS account

DjangoCloud runs your app in **your** AWS account, on Amazon Lightsail. You pay AWS directly for the servers, at AWS list prices. To do that it needs an IAM access key.

{% hint style="warning" %}
Create a dedicated IAM user for this. Never use your root account keys.
{% endhint %}

## Steps

1. In the AWS console open **IAM → Users → Create user**, for example `djangocloud`.
2. Attach this policy to the user. It lets DjangoCloud run your app on Lightsail and set up a small build environment in your account (a build project, a private bucket for build inputs, a role and logs). It has no access to any other service:

   ```json
   {
     "Version": "2012-10-17",
     "Statement": [
       {
         "Effect": "Allow",
         "Action": [
           "lightsail:*",
           "sts:GetCallerIdentity"
         ],
         "Resource": "*"
       },
       {
         "Effect": "Allow",
         "Action": [
           "servicequotas:GetServiceQuota",
           "servicequotas:GetAWSDefaultServiceQuota",
           "servicequotas:ListServiceQuotas",
           "servicequotas:RequestServiceQuotaIncrease",
           "servicequotas:GetRequestedServiceQuotaChange",
           "servicequotas:ListRequestedServiceQuotaChangeHistory",
           "servicequotas:ListRequestedServiceQuotaChangeHistoryByQuota"
         ],
         "Resource": "*"
       },
       {
         "Effect": "Allow",
         "Action": [
           "kms:CreateGrant",
           "kms:DescribeKey",
           "kms:ListAliases",
           "kms:ListGrants",
           "kms:Decrypt",
           "kms:GenerateDataKey",
           "kms:GenerateDataKeyWithoutPlaintext",
           "kms:ReEncrypt*"
         ],
         "Resource": "*"
       },
       {
         "Effect": "Allow",
         "Action": "codebuild:*",
         "Resource": "arn:aws:codebuild:*:*:project/djangocloud-build*"
       },
       {
         "Effect": "Allow",
         "Action": [
           "logs:CreateLogGroup",
           "logs:PutRetentionPolicy",
           "logs:GetLogEvents",
           "logs:DescribeLogStreams"
         ],
         "Resource": [
           "arn:aws:logs:*:*:log-group:/aws/codebuild/djangocloud-build",
           "arn:aws:logs:*:*:log-group:/aws/codebuild/djangocloud-build:*"
         ]
       },
       {
         "Effect": "Allow",
         "Action": "s3:*",
         "Resource": [
           "arn:aws:s3:::djangocloud-build-*-*",
           "arn:aws:s3:::djangocloud-build-*-*/*"
         ]
       },
       {
         "Effect": "Allow",
         "Action": [
           "iam:CreateRole",
           "iam:GetRole",
           "iam:PutRolePolicy",
           "iam:TagRole"
         ],
         "Resource": "arn:aws:iam::*:role/djangocloud-build-*"
       },
       {
         "Effect": "Allow",
         "Action": "iam:PassRole",
         "Resource": "arn:aws:iam::*:role/djangocloud-build-*",
         "Condition": {
           "StringEquals": {
             "iam:PassedToService": "codebuild.amazonaws.com"
           }
         }
       }
     ]
   }
   ```
3. Under **Security credentials**, create an access key.
4. In the DjangoCloud dashboard open **Settings → AWS account**, choose a [region](/django-cloud-docs/reference/regions.md), and paste the access key ID and secret access key.

DjangoCloud checks the keys with AWS before saving them.

## What this costs you

Your app's servers are billed by AWS at Lightsail list prices. Builds run in AWS CodeBuild in your account and cost a few cents each.

{% hint style="info" %}
If your AWS account is brand new, AWS may need some hours to enable builds for it the first time. DjangoCloud asks for it automatically and shows "Waiting for AWS to enable builds" on your deployment page, then continues on its own.
{% endhint %}

## How the keys are handled

* The secret is encrypted at rest and only used to deploy your projects.
* It is never shown again after you save it.
* You can revoke the key in IAM at any time, or **disconnect** your account in the dashboard.
* Disconnecting does not stop anything. Existing deployments keep running on AWS.

## Choosing a region

Pick the region closest to your users. All deployments created while a region is connected go there. See the [list of supported regions](/django-cloud-docs/reference/regions.md).


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://django-cloud.gitbook.io/django-cloud-docs/getting-started/connect-aws.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
