const ec2Spot = require('ec2-spot')
const spotInstance = new ec2Spot(AWSCertificate,SpotInstanceConfig,startUpCommand,webHookEndpoints)
spot.launch(function (err, result) {
console.log(err)
console.log(JSON.stringify(result, null, 2))
})
{
"accessKeyId": "",
"secretAccessKey":"",
"region": ""
}
{
"LaunchSpecification": {
"IamInstanceProfile": {
Arn: ""
},
"ImageId": "",
"InstanceType": "",
"KeyName": "",
"SecurityGroupIds": []
},
"SpotPrice": "",
"Type": ""
}
let cmd = []
cmd.push(`#!/bin/bash`)
cmd.push(`git clone -b develop https://${config.id}:${config.passwd}@bitbucket.org/${config.group}/${config.project}.git`)
cmd.push(`cd ${config.project}`)
cmd.push(`npm install`)
cmd.push(`node run`)
{
cmd: cmd.join('\n')
}
{
create: {
url: `${config.startWebhookUrl}`
},
terminate: {
url: `${config.endWebhookUrl}`
}
}