Start RDS clusters based on Tag values
Earlier, in my blog post, I have posted an article to "Stop RDS clusters based on Tag values"...
Now let us see how to start every morning just before our office time starts...
Steps to automate RDS starting in AWS:
- Login to your AWS account via console
- Go to services Lambda -> Author from scratch -> Give a Name; select 'Runtime-> Python2.7; Choose a Role -> Choose an existing Role; Existing Role-> Role that is already available in your account to run the Lambda script
- Click on 'Create Function'
- Click on your lambda function which expands to the code IDE for writing your python code
- Now copy the code from my github account[https://github.com/gvnirmalaa/utilities/blob/master/l_startRDS_UseTags.py] into the Python script IDE
- Now, from the designer pane -> click on 'Cloudwatch' -> to select the cloud watch rule which has the definition of scheduling timelines to execute this lambda script
Steps to create Cloud watch Rule:
- Goto or select service 'Cloudwatch' in your AWS console/account
- Click on 'Rules' -> 'Create Rule' -> 'Event source-> scheduler' -> 'cron expression' -> define or set the timing by which the lambda script is to be scheduled; for example, 9AM if office time starts at 9AM...
- From the top right corner, click on the 'Add Target' -> Lambda -> <<select the lambda function created from above step'
- Click on 'Configure Details'
- Now a cron scheduler is ready for executing any lambda scripts as per the requirement
Note: the script will work only when you add tags against your existing or new RDS as 'start:yes'
No comments:
Post a Comment