Skip to content

Instantly share code, notes, and snippets.

@joemccann
Created June 4, 2021 18:30
Show Gist options
  • Save joemccann/134a2cbaa2eb5967f3975e9b083b4a73 to your computer and use it in GitHub Desktop.
Save joemccann/134a2cbaa2eb5967f3975e9b083b4a73 to your computer and use it in GitHub Desktop.
#!/usr/bin/env zx
//
// Get array of lambda ARNs
//
let lambdas = JSON.parse(
await $`aws lambda list-functions --function-version ALL --output json --query "Functions[?Runtime=='nodejs10.x'].FunctionArn"`
)
//
// Iterate over them and update
//
for (let l of lambdas) {
//
// l = "arn:aws:lambda:us-west-2:500402104533:function:news:$LATEST"
//
const split = l.split(':')
const functionName = split[split.length - 2]
//
// functionName = news
//
console.log(`Updating lambda function ${functionName}`)
await $`aws lambda update-function-configuration --runtime nodejs14.x --function-name ${functionName}`
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment