This project is about automating AWS Elastic compute cloud (EC2) instances by starting them in the morning (6.00 AM UTC) and terminating them in the evening (11.00 PM UTC). The provisioning of the AWS resources are done using AWS Cloud development kit(CDK).
- Amazon Web Service(AWS) (Cloud Provider)
- AWS CLI
- Cloud Development Kit (CDK) - For infrastructure provisioning.
- Typescript - Language for infrastructure provisioning. Python, C#, Java can also be use.
- Python - For writing lambda functions for automation. Javascript, C#, Java, Go and Ruby can also be use.
- Install NodeJS - CDK is build on top of node thus you will need to install nodejs before installing CDK.
- Install and configure AWS CLI using your generated AWS credentials
- AWS EC2
- AWS EVENT BRIDGE
- AWS LAMBDA FUNCTION
- AWS IAM ROLE
The event bridge is used to set a cron job which will in turn call lambda function that will in turn start/stop the ec2 instance.
EVENT BRIDGE ➡️ LAMBDA FUNCTION ➡️ EC2
NB: Appropriate IAM role need to be assigned to Lambda to be able to start/stop EC2
$ cd cdk
$ npm install
In the cdk directory, enter the following command
# To bootstrap the resources declared in the stack
$ cdk bootstrap
# (Optional) To output the cloud formation equivalent of the cdk stacks
$ cdk synth
# To deploy cdk stacks to AWS cloud
$ cdk deploy
👯 👯 Violaa :) Your infrastructure have been provision using infrastructure as code.
- IJONI VICTOR 😁😁😁
Please 🙏 don't forget to star ⭐ the project 😁😁 . Thanks 👍