Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/EugeneK6S/route53-cleanup
Lambda function to clean up stale Route53 entries
https://github.com/EugeneK6S/route53-cleanup
lambda route53
Last synced: 3 months ago
JSON representation
Lambda function to clean up stale Route53 entries
- Host: GitHub
- URL: https://github.com/EugeneK6S/route53-cleanup
- Owner: EugeneK6S
- Created: 2018-02-22T09:18:47.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2018-02-22T12:36:40.000Z (almost 7 years ago)
- Last Synced: 2024-08-04T08:06:00.207Z (7 months ago)
- Topics: lambda, route53
- Language: Python
- Size: 4.88 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Lambda function for Route53 cleanup
===================================
Main logic is forked from [fsalum/scripts](https://github.com/fsalum/scripts), reworked a bit.This Lambda will get the list of all HostedZones per account, iterate over them and clean up stale Route53 entries.
The stale state is defined by:
- correlating IP addresses (private and public) of running EC2 instances with A entries in Route53
- correlating public and private DNS of EC2 intances with CNAME entries in Route53# USAGE (as Lambda):
1. Clone the repo
2. Initialize Virtualenv (highly advised)
```
virtualenv .
```
3. Install requirements
```
pip install -r requirements.txt
```
4. Put dependencies into deployment ZIP
```
cd ./lib/python2.7/site-packages
zip -ur10 ~// *
```
5. Put main.py into deployment ZIP
```
zip -u ~// main.py
```
6. Register Lambda function:
```
aws lambda create-function \
--region \
--function-name \
--zip-file fileb:/// \
--role arn:aws:iam: \
--handler main.lambda_handler \
--runtime python2.7 \
--timeout 60 \
--memory-size 128 \
--profile
```
7. Additionally, I'd advise setting up CloudWatch event, that will trigger Lambda on schedule.*TODO*: move to boto3 or better Golang.