This repository contains Terraform configurations that deploy an Remote Desktop Gateway solution in an AWS account.
While AWS have published a Quick Start that uses CloudFormation to deploy the RD Gateway in various scenarios, they do not provide a solution for the SSL certificates that are required for each RD Gateway instance.
The solution presented here uses certbot running as a Lambda function that gets a Letsencrypt SSL certificate that is good for 90 days. The certbot Lambda function runs on a schedule and gets a new SSL certificate every 60 days and saves the certificate in an S3 bucket. Upon receiving a new SSL certificate, the S3 bucket notifies an SQS queue so that the RD Gateway that listenes to that SQS queue every day is able to download the new certificate from S3 and install it on the RD Gateway server. This workflow ensures that the RD Gateway instance has a valid SSL certificate that is renenwed forever.
Please check the wiki page for a step-by-step tutorial on this solution.
- Amazon Web Services (AWS) account.
- Terraform 0.13 installed on your computer. Check out HasiCorp documentation on how to install Terraform.
- Registered Internet domain. Check out Dot TK Registry as they offer free .tk domains.
- Git installed on your computer. Check out the download page to get the package for your operating system.
- Configure your AWS access keys as environment variables:
$ export AWS_ACCESS_KEY_ID=(your access key id)
$ export AWS_SECRET_ACCESS_KEY=(your secret access key)
- Clone this repository:
$ git clone https://github.com/RaduLupan/terraform-rdgateway-aws.git
$ cd terraform-rdgateway-aws
- Optional: create a Virtual Private Cloud (VPC):
$ cd vpc
$ terraform init
$ terraform apply
- Optional: create a Simple AD or Microsoft AD directory:
$ cd ad
$ terraform init
$ terraform apply
- Create the letsencrypt-tls layer:
$ cd letsencrypt-tls
$ terraform init
$ terraform apply
- Create the rd-gateway layer:
$ cd rd-gateway
$ terraform init
$ terraform apply
Thank you kingsoftgames for your certbot-lambda implementation! I have found your code back in 2018 and have been running it at work ever since. Instead of manually renewing and installing the SSL certificates on a dozen RD Gateways we have in AWS, we have been receiving email notifications advising that the certificates have been renewed!