https://github.com/zcemycl/aws-serverless-ddns-terraform
Deployment of DDNS into AWS resources through terraform
https://github.com/zcemycl/aws-serverless-ddns-terraform
apigateway apikey aws aws-dynamodb aws-lambda aws-route53 boto3 cloudwatch-logs dynamodb nosql nosql-database python terraform
Last synced: 2 months ago
JSON representation
Deployment of DDNS into AWS resources through terraform
- Host: GitHub
- URL: https://github.com/zcemycl/aws-serverless-ddns-terraform
- Owner: zcemycl
- License: mit
- Created: 2023-10-17T20:03:02.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-06-18T19:26:33.000Z (10 months ago)
- Last Synced: 2025-02-17T10:53:18.369Z (2 months ago)
- Topics: apigateway, apikey, aws, aws-dynamodb, aws-lambda, aws-route53, boto3, cloudwatch-logs, dynamodb, nosql, nosql-database, python, terraform
- Language: HCL
- Homepage:
- Size: 162 KB
- Stars: 0
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# aws-serverless-ddns-terraform
The repository to deploy ddns through terraform into aws environment, using API Gateway, Route53 and Lambda. It implements the architecture suggested by [Building a serverless dynamic DNS system with AWS](https://aws.amazon.com/blogs/startups/how-to-build-a-serverless-dynamic-dns-system-with-aws/#:~:text=AWS%20Services%20We%20Use%20in%20Our%20Dynamic%20DNS%20system&text=Your%20code%20is%20always%20ready,events%20from%20other%20AWS%20services) and improves it by introducing API-Gateway so DDNS is protected away from non-intended users.
## How to run?
1. Set up the infrastructure by terraform.
```bash
cd architecture
terraform init
terraform apply -auto-approve
```
2. Export environment variables for python script.
```bash
export APIGW_INVOKE_URI=
export X_API_KEY=
```
3. Run cronjob to regularly update. `python src/local/main.py`
```bash
# linux
sudo apt update
sudo apt install cron
# macos -> need permission settings
brew install cron# common after installation
crontab -e
# add this
*/2 * * * * APIGW_INVOKE_URI= X_API_KEY= python src/local/main.py >> log.txt 2>&1
```### References
1. https://www.youtube.com/watch?v=yzT92pEcIvM
2. https://aws.amazon.com/blogs/startups/how-to-build-a-serverless-dynamic-dns-system-with-aws/#:~:text=AWS%20Services%20We%20Use%20in%20Our%20Dynamic%20DNS%20system&text=Your%20code%20is%20always%20ready,events%20from%20other%20AWS%20services.
3. https://www.bejarano.io/fixing-cron-jobs-in-mojave/