Last active
January 10, 2020 07:19
-
-
Save PrashantBhatasana/0b7e0a6eb93680dff5a131845f137733 to your computer and use it in GitHub Desktop.
This is lambda function with javascript language that start ec2 instence.
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
// StartEC2Instance | |
const AWS = require('aws-sdk'); | |
exports.handler = (event, context, callback) => { | |
const ec2 = new AWS.EC2({ region: event.instanceRegion }); | |
ec2.startInstances({ InstanceIds: [event.instanceId] }).promise() | |
.then(() => callback(null, `Successfully started ${event.instanceId}`)) | |
.catch(err => callback(err)); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment