All Projects → abdullahkhawer → Aws Auto Terminate Idle Emr

abdullahkhawer / Aws Auto Terminate Idle Emr

AWS Auto Terminate Idle AWS EMR Clusters Framework is an AWS based solution using AWS CloudWatch and AWS Lambda using a Python script that is using Boto3 to terminate AWS EMR clusters that have been idle for a specified period of time.

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Aws Auto Terminate Idle Emr

Autospotting
Saves up to 90% of AWS EC2 costs by automating the use of spot instances on existing AutoScaling groups. Installs in minutes using CloudFormation or Terraform. Convenient to deploy at scale using StackSets. Uses tagging to avoid launch configuration changes. Automated spot termination handling. Reliable fallback to on-demand instances.
Stars: ✭ 2,014 (+9490.48%)
Mutual labels:  automation, aws, aws-lambda, cloudformation, amazon-web-services
Aws Etl Orchestrator
A serverless architecture for orchestrating ETL jobs in arbitrarily-complex workflows using AWS Step Functions and AWS Lambda.
Stars: ✭ 245 (+1066.67%)
Mutual labels:  aws, serverless, amazon-web-services, bigdata, etl
Aws Cf Templates
A cloudonaut.io project. Engineered by widdix.
Stars: ✭ 2,399 (+11323.81%)
Mutual labels:  aws, cloudformation, amazon-web-services, aws-cloudformation
Docs
Rapid CloudFormation: Modular, production ready, open source.
Stars: ✭ 209 (+895.24%)
Mutual labels:  aws, cloudformation, amazon-web-services, aws-cloudformation
Cfn Generic Custom Resource
CloudFormation generic custom resource provider
Stars: ✭ 26 (+23.81%)
Mutual labels:  aws, aws-lambda, cloudformation, aws-cloudformation
Cfn Create Or Update
Create or update CloudFormation stack also if no updates are to be performed.
Stars: ✭ 59 (+180.95%)
Mutual labels:  aws, cloudformation, amazon-web-services, aws-cloudformation
Serverless static website with basic auth
Builds a serverless infrastructure in AWS for hosting a static website protected with Basic Authentication and published on a subdomain registered via Route 53
Stars: ✭ 112 (+433.33%)
Mutual labels:  aws, serverless, aws-lambda, cloudformation
Serverless Aws Lambda Node Postgres
Serverless AWS Lambda with Node.js,Postgres Rest API with Sequelize.
Stars: ✭ 18 (-14.29%)
Mutual labels:  aws, serverless, aws-lambda, cloudformation
Perun
A command-line validation tool for AWS Cloud Formation that allows to conquer the cloud faster!
Stars: ✭ 82 (+290.48%)
Mutual labels:  aws, cloudformation, amazon-web-services, aws-cloudformation
Serverlessbydesign
A visual approach to serverless development. Think. Build. Repeat.
Stars: ✭ 254 (+1109.52%)
Mutual labels:  aws, serverless, aws-lambda, cloudformation
Panther
Detect threats with log data and improve cloud security posture
Stars: ✭ 885 (+4114.29%)
Mutual labels:  aws, serverless, bigdata, etl
Serverless Es Logs
A Serverless plugin to transport logs to ElasticSearch
Stars: ✭ 51 (+142.86%)
Mutual labels:  aws, serverless, aws-lambda, amazon-web-services
Aws Lambda Typescript
This sample uses the Serverless Application Framework to implement an AWS Lambda function in TypeScript, deploy it via CloudFormation, publish it through API Gateway to a custom domain registered on Route53, and document it with Swagger.
Stars: ✭ 228 (+985.71%)
Mutual labels:  aws, serverless, aws-lambda, aws-cloudformation
Cloudmagick
CloudMagick is a serverless application which provides a dynamic image transformation like the small light module of apache2
Stars: ✭ 11 (-47.62%)
Mutual labels:  aws, serverless, aws-lambda, cloudformation
Aws Auto Cleanup
Open-source application to programmatically clean your AWS resources based on a whitelist and time to live (TTL) settings
Stars: ✭ 276 (+1214.29%)
Mutual labels:  aws, serverless, aws-lambda, amazon-web-services
Aws Demos
A hands on repo with multiple demonstrations on AWS 🎓
Stars: ✭ 324 (+1442.86%)
Mutual labels:  automation, aws, serverless, cloudformation
Aws Serverless Auth Reference App
Serverless reference app and backend API, showcasing authentication and authorization patterns using Amazon Cognito, Amazon API Gateway, AWS Lambda, and AWS IAM.
Stars: ✭ 724 (+3347.62%)
Mutual labels:  aws, serverless, aws-lambda
Dawson Cli
A serverless web framework for Node.js on AWS (CloudFormation, CloudFront, API Gateway, Lambda)
Stars: ✭ 721 (+3333.33%)
Mutual labels:  aws, serverless, cloudformation
Gofaas
A boilerplate Go and AWS Lambda app. Demonstrates an expert configuration of 10+ AWS services to support running Go functions-as-a-service (FaaS).
Stars: ✭ 731 (+3380.95%)
Mutual labels:  serverless, aws-lambda, cloudformation
Aws Cloudformation Coverage Roadmap
The AWS CloudFormation Public Coverage Roadmap
Stars: ✭ 800 (+3709.52%)
Mutual labels:  aws, cloudformation, aws-cloudformation

AWS Auto Terminate Idle AWS EMR Clusters Framework

Introduction

AWS Auto Terminate Idle AWS EMR Clusters Framework is an AWS based solution using AWS CloudWatch and AWS Lambda using a Python script that is using Boto3 to terminate AWS EMR clusters that have been idle for a specified period of time.

You specify the maximum idle time threshold and AWS CloudWatch event/rule triggers an AWS Lambda function that queries all AWS EMR clusters in WAITING state and for each, compares the current time with AWS EMR cluster's ready time in case of no EMR steps added so far or compares the current time with AWS EMR cluster's last step's end time. If the threshold has been compromised, the AWS EMR will be terminated after removing termination protection if enabled. If not, it will skip that AWS EMR cluster.

AWS CloudWatch event/rule will decide how often AWS Lambda function should check for idle AWS EMR clusters.

You can disable the AWS CloudWatch event/rule at any time to disable this framework in a single click without deleting its AWS CloudFormation stack.

AWS Lambda function is using Python 3.7 as its runtime environment.

Any contributions, improvements and suggestions will be highly appreciated.

Components Used

Following are the components used in this framework:

  • Python script having the main logic developed in Python 3.7.
  • Boto3 for AWS resources access in Python.
  • AWS CloudFormation template (both in JSON and YAML) for stack deployment.
  • AWS CloudWatch event for scheduling trigger.
  • AWS Lambda function to execute the main Python script.
  • AWS IAM role used by the Lambda function with least privileges.
  • AWS Lambda Invoke Permission for AWS CloudWatch event.

Usage Notes

Following are the steps to successfully deploy and use this framework:

  • Clone this repository from the master branch.
  • Compress aws_auto_terminate_idle_emr.py file in zip format and put it on AWS S3 bucket.
  • Login to AWS console with IAM user credentials having the required admin privileges to create resources via AWS CloudFormation.
  • Go to AWS CloudFormation and choose to Create Stack.
  • Under Choose a template, either upload aws_auto_terminate_idle_emr_cft.json or aws_auto_terminate_idle_emr_cft.yaml from here or put it on AWS S3 bucket and enter AWS S3 URL for that file.
  • Enter any suitable Stack Name.
  • Enter CloudWatchEventScheduleExpression which is AWS CloudWatch Event's Schedule Expression in the form of either Rate Function (e.g., rate(5 minutes)) or Cron Expression (e.g., cron(0/5 * * * ? *)) which will decide how ofter to trigger AWS Lambda function that does the actual job.
  • Enter LambdaCodeS3Bucket which is AWS S3 Bucket Name having AWS Lambda Function Code (e.g., my-bucket).
  • Enter LambdaCodeS3BucketKey which is AWS S3 Bucket Key having AWS Lambda Function Code (e.g., lambda/code/aws_auto_terminate_idle_emr.zip).
  • Enter MaxIdleTimeInMinutes which is Maximum Idle Time in Minutes for Any AWS EMR Cluster.
  • Enter suitable Tags if required.
  • Under Review, select I acknowledge that AWS CloudFormation might create IAM resources with custom names. and click create.
  • Wait for the stack to change its Status to CREATE_COMPLETE.
  • Voila, you are done and everything is now up and running.

Warning: You will be billed for the AWS resources used if you create a stack for this framework.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].