This file contains 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
<?php | |
function camel_to_snake($input) | |
{ | |
return strtolower(preg_replace('/(?<!^)[A-Z]/', '_$0', $input)); | |
} | |
function snakeToCamel($input) | |
{ | |
return lcfirst(str_replace(' ', '', ucwords(str_replace('_', ' ', $input)))); | |
} |
This file contains 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
// Demonstration video can be found at: https://youtu.be/roAerKVfq-Y | |
// StopEC2Instance | |
const AWS = require('aws-sdk'); | |
exports.handler = (event, context, callback) => { | |
const ec2 = new AWS.EC2({ region: event.instanceRegion }); | |
ec2.stopInstances({ InstanceIds: [event.instanceId] }).promise() |