2019-03-08 18:47:06 +00:00
---
title: "Amazon Route 53"
date: 2019-03-03T16:39:46+01:00
draft: false
slug: route53
2022-06-16 22:25:42 +00:00
dnsprovider:
since: "v0.3.0"
code: "route53"
url: "https://aws.amazon.com/route53/"
2019-03-08 18:47:06 +00:00
---
<!-- THIS DOCUMENTATION IS AUTO - GENERATED. PLEASE DO NOT EDIT. -->
<!-- providers/dns/route53/route53.toml -->
<!-- THIS DOCUMENTATION IS AUTO - GENERATED. PLEASE DO NOT EDIT. -->
Configuration for [Amazon Route 53 ](https://aws.amazon.com/route53/ ).
<!-- more -->
- Code: `route53`
2022-06-16 22:25:42 +00:00
- Since: v0.3.0
2019-03-08 18:47:06 +00:00
2023-01-20 15:32:33 +00:00
Here is an example bash command using the Amazon Route 53 provider:
```bash
AWS_ACCESS_KEY_ID=your_key_id \
AWS_SECRET_ACCESS_KEY=your_secret_access_key \
AWS_REGION=aws-region \
AWS_HOSTED_ZONE_ID=your_hosted_zone_id \
2024-02-03 02:36:43 +00:00
lego --domains example.com --email your_example@email.com --dns route53 --accept-tos=true run
2023-01-20 15:32:33 +00:00
```
2019-03-08 18:47:06 +00:00
## Credentials
| Environment Variable Name | Description |
|-----------------------|-------------|
2021-06-28 01:31:18 +00:00
| `AWS_ACCESS_KEY_ID` | Managed by the AWS client. Access key ID (`AWS_ACCESS_KEY_ID_FILE` is not supported, use `AWS_SHARED_CREDENTIALS_FILE` instead) |
2023-05-17 16:42:06 +00:00
| `AWS_ASSUME_ROLE_ARN` | Managed by the AWS Role ARN (`AWS_ASSUME_ROLE_ARN_FILE` is not supported) |
2023-05-28 08:36:37 +00:00
| `AWS_EXTERNAL_ID` | Managed by STS AssumeRole API operation (`AWS_EXTERNAL_ID_FILE` is not supported) |
2021-06-28 01:31:18 +00:00
| `AWS_HOSTED_ZONE_ID` | Override the hosted zone ID. |
2020-05-30 12:00:57 +00:00
| `AWS_PROFILE` | Managed by the AWS client (`AWS_PROFILE_FILE` is not supported) |
2020-01-09 08:12:27 +00:00
| `AWS_REGION` | Managed by the AWS client (`AWS_REGION_FILE` is not supported) |
2021-06-28 01:31:18 +00:00
| `AWS_SDK_LOAD_CONFIG` | Managed by the AWS client. Retrieve the region from the CLI config file (`AWS_SDK_LOAD_CONFIG_FILE` is not supported) |
| `AWS_SECRET_ACCESS_KEY` | Managed by the AWS client. Secret access key (`AWS_SECRET_ACCESS_KEY_FILE` is not supported, use `AWS_SHARED_CREDENTIALS_FILE` instead) |
2024-05-09 19:05:21 +00:00
| `AWS_WAIT_FOR_RECORD_SETS_CHANGED` | Wait for changes to be INSYNC (it can be unstable) |
2019-03-08 18:47:06 +00:00
2019-03-18 16:42:54 +00:00
The environment variable names can be suffixed by `_FILE` to reference a file instead of a value.
2022-06-16 22:25:42 +00:00
More information [here ]({{< ref "dns#configuration-and-credentials" >}} ).
2019-03-18 16:42:54 +00:00
2019-03-08 18:47:06 +00:00
## Additional Configuration
| Environment Variable Name | Description |
|--------------------------------|-------------|
2019-04-17 18:58:34 +00:00
| `AWS_MAX_RETRIES` | The number of maximum returns the service will use to make an individual API request |
2019-03-08 18:47:06 +00:00
| `AWS_POLLING_INTERVAL` | Time between DNS propagation check |
| `AWS_PROPAGATION_TIMEOUT` | Maximum waiting time for DNS propagation |
2021-06-28 01:31:18 +00:00
| `AWS_SHARED_CREDENTIALS_FILE` | Managed by the AWS client. Shared credentials file. |
2019-03-08 18:47:06 +00:00
| `AWS_TTL` | The TTL of the TXT record used for the DNS challenge |
2019-03-18 16:42:54 +00:00
The environment variable names can be suffixed by `_FILE` to reference a file instead of a value.
2022-06-16 22:25:42 +00:00
More information [here ]({{< ref "dns#configuration-and-credentials" >}} ).
2019-03-18 16:42:54 +00:00
2019-03-08 18:47:06 +00:00
## Description
AWS Credentials are automatically detected in the following locations and prioritized in the following order:
2020-05-30 12:00:57 +00:00
1. Environment variables: `AWS_ACCESS_KEY_ID` , `AWS_SECRET_ACCESS_KEY` , [`AWS_SESSION_TOKEN`]
2. Shared credentials file (defaults to `~/.aws/credentials` , profiles can be specified using `AWS_PROFILE` )
2019-03-08 18:47:06 +00:00
3. Amazon EC2 IAM role
2020-05-30 12:00:57 +00:00
The AWS Region is automatically detected in the following locations and prioritized in the following order:
1. Environment variables: `AWS_REGION`
2. Shared configuration file if `AWS_SDK_LOAD_CONFIG` is set (defaults to `~/.aws/config` , profiles can be specified using `AWS_PROFILE` )
2019-03-08 18:47:06 +00:00
If `AWS_HOSTED_ZONE_ID` is not set, Lego tries to determine the correct public hosted zone via the FQDN.
2020-01-09 08:12:27 +00:00
See also:
- [sessions ](https://docs.aws.amazon.com/sdk-for-go/v1/developer-guide/sessions.html )
2020-05-30 12:00:57 +00:00
- [Setting AWS Credentials ](https://docs.aws.amazon.com/sdk-for-go/v1/developer-guide/configuring-sdk.html#specifying-credentials )
- [Setting AWS Region ](https://docs.aws.amazon.com/sdk-for-go/v1/developer-guide/configuring-sdk.html#specifying-the-region )
2019-03-08 18:47:06 +00:00
2022-10-12 18:42:06 +00:00
## IAM Policy Examples
2019-03-08 18:47:06 +00:00
2022-10-12 18:42:06 +00:00
### Broad privileges for testing purposes
The following [IAM policy ](https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html ) document grants access to the required APIs needed by lego to complete the DNS challenge.
A word of caution:
These permissions grant write access to any DNS record in any hosted zone,
so it is recommended to narrow them down as much as possible if you are using this policy in production.
2019-03-08 18:47:06 +00:00
```json
{
2022-10-12 18:42:06 +00:00
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"route53:GetChange",
"route53:ChangeResourceRecordSets",
"route53:ListResourceRecordSets"
],
"Resource": [
"arn:aws:route53:::hostedzone/*",
"arn:aws:route53:::change/*"
]
},
{
"Effect": "Allow",
"Action": "route53:ListHostedZonesByName",
"Resource": "*"
}
]
2019-03-08 18:47:06 +00:00
}
```
2022-10-12 18:42:06 +00:00
### Least privilege policy for production purposes
2023-07-29 10:59:24 +00:00
The following AWS IAM policy document describes the least privilege permissions required for lego to complete the DNS challenge.
2022-10-12 18:42:06 +00:00
Write access is limited to a specified hosted zone's DNS TXT records with a key of `_acme-challenge.example.com` .
Replace `Z11111112222222333333` with your hosted zone ID and `example.com` with your domain name to use this policy.
```json
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": "route53:GetChange",
"Resource": "arn:aws:route53:::change/*"
},
{
"Effect": "Allow",
"Action": "route53:ListHostedZonesByName",
"Resource": "*"
},
{
"Effect": "Allow",
"Action": [
"route53:ListResourceRecordSets"
],
"Resource": [
"arn:aws:route53:::hostedzone/Z11111112222222333333"
]
},
{
"Effect": "Allow",
"Action": [
"route53:ChangeResourceRecordSets"
],
"Resource": [
"arn:aws:route53:::hostedzone/Z11111112222222333333"
],
"Condition": {
"ForAllValues:StringEquals": {
"route53:ChangeResourceRecordSetsNormalizedRecordNames": [
"_acme-challenge.example.com"
],
"route53:ChangeResourceRecordSetsRecordTypes": [
"TXT"
]
}
}
}
]
}
```
2019-03-08 18:47:06 +00:00
## More information
- [API documentation ](https://docs.aws.amazon.com/Route53/latest/APIReference/API_Operations_Amazon_Route_53.html )
2023-07-27 10:15:26 +00:00
- [Go client ](https://github.com/aws/aws-sdk-go-v2 )
2019-03-08 18:47:06 +00:00
<!-- THIS DOCUMENTATION IS AUTO - GENERATED. PLEASE DO NOT EDIT. -->
<!-- providers/dns/route53/route53.toml -->
<!-- THIS DOCUMENTATION IS AUTO - GENERATED. PLEASE DO NOT EDIT. -->