Never forget that instance running again
A Cloud Infrastructure Management Tool to stop, resume, clean and destroy resources based on tags. Reka uses a config to determine what actions should be taken on resources. It can prove to be a cost management tool where you can stop your tests environments during breaks, holidays and non-working hours. It can also be a nuke tool to nuke an account. It currently supports both AWS and GCP. A full list of supported resources can be found here
- Stop/Resume resources for example stopping an EC2 instance or resizing an EKS cluster to 0.
- Destroy/Terminate resources
- Clean Up unused resources (such as EBS volumes, Elastic IPs)
REKA
is derived from a Native Nigerian Language, Igbo, meaning Reap
|Tear Down
.
This tool is HIGHLY DESTRUCTIVE and deletes cloud resources! This should be used in environments with WITH CAUTION.
The Reka binary can be downloaded from the Releases and executed directly on its respective OS.
The reka image is also available on DockerHub.
docker pull mensaah/reka
If config.yaml
is in the current directory, reka can be executed as:
docker run -it -e AWS_ACCESS_KEY -e AWS_SECRET_ACCESS_KEY\
-v `pwd`:/config mensaah/reka --config /config/config.yaml
Reka can also be installed like a regular golang Binary if go is installed
go get -u github.com/mensaah/reka
Reka uses a config file to know what resources to target and the actions to be taken for such resources. Here is an example configuration file that Reka uses.
reka --config config.yaml
# To run without destroying any instance, basically just stops, resumes resources
reka --config config.yaml --disable-destroy
# To see full range of commands that can executed with reka
reka help
# View supported resources
reka resources
-
AWS To use AWS Provider, you need to either have your aws credentials setup or export
AWS_ACCESS_KEY_ID
,AWS_SECRET_ACCESS_KEY
and optionallyAWS_SESSION_TOKEN
(optional). -
GCP You can authenticate to GCP Provider by providing by setting the environment variable
GOOGLE_APPLICATION_CREDENTIALS
which is the path to the service account credentials. Ifgcloud
is configured, thegcloud
profile can also be used
Reka supports different resource rules. These are usually in the form:
rules:
- name: <RULE_NAME>
# Target specific resource types
target:
- resource-targets
tags:
tagKey1: tagValue1
tagKey2: tagValue2
condition:
CONDITIONS
Conditions needs to be met before the action is taken on the resource.
This configuration sets that EC2 and EKS resources with tag env = staging
needs to be active only within 7am - 7pm from Mondays to Fridays. When reka runs in any time outside that, the resource is stopped if stoppable and resumed once the condition is met.
rules:
- name: stop all staging instances after work and during weekends
tags:
env: staging
resources:
- aws.ec2
- aws.eks
region: "us-east-2"
condition:
activeDuration:
startTime: "7:00"
stopTime: "19:00"
startDay: Monday
stopDay: Friday
Specifying the resources
list in any rule only applies the rules to those resources alone.
rules:
- name: nuke all demo instances 2 weeks after demo october 9th (staging)
tags:
env: test
project: proj-demo
condition:
terminationDate: "2021-10-23 01:00"
rules:
- name: Delete all unused instances
condition:
terminationPolicy: unused
You can additionally exclude resources which will make Reka not to act on those resources even when the satisfy a condition and a rule.
exclude:
- name: Exclude resources with prod tags in us-east-2
region: "us-east-2"
tags:
env: prod
- name: Exclude CI EC2 Instances on staging
tags:
env: staging
ci-runner: true
resources:
- aws.ec2
- Schedule resource refreshing
- generate Sample Yaml config and load config
- Persist state to remote sources
- Add More AWS Resources
- Add More GCP Resources
- Add MoreAzure Resources
- Create Web Dashboard to ease running reka
- Tests 😆😆😆
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.