Created
March 17, 2017 16:25
-
-
Save chrisbodhi/282467b2cdee7851c4333d9d2a467037 to your computer and use it in GitHub Desktop.
Kyle wrote this. Thanks, Kyle!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require('date') | |
require('json') | |
lambdas = JSON.parse(`aws lambda list-functions`)["Functions"] | |
delete_before_this_date = Date.new(2017, 2, 1) | |
to_nuke = lambdas.select do |lambda| | |
!lambda["FunctionName"].include? "pipeline-orchestra" | |
end | |
to_nuke.each do |lambda| | |
lambda_date = Date.iso8601(lambda["LastModified"]) | |
if lambda_date < delete_before_this_date | |
function_name = lambda["FunctionName"] | |
`aws lambda delete-function --function-name #{function_name}` | |
print 'D' | |
else | |
print '.' | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment