-
Notifications
You must be signed in to change notification settings - Fork 9
/
ec2UpdateSuccess.js
47 lines (41 loc) · 1.19 KB
/
ec2UpdateSuccess.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
/* eslint no-extend-native: 0 */
/**
* @fileOverview An example use of the module.
*
* This attempts to update a simple EC2 stack using one of the simple AWS
* example templates.
*
* To run:
*
* node examples/ec2DeployFailure.js <stackName>
*
* Before running you must use ec2DeploySuccess.js to create a stack, and take
* note of the stack name, to supply to this script.
*/
var util = require('util');
var example = require('./lib/ec2UpdateBase');
if (process.argv.length < 3) {
console.error('You must provide a stackName argument.');
process.exit(1);
}
var stackName = process.argv[2];
example.run(stackName, 't1.micro', function (error, result) {
// This enables error messages to show up in the JSON output. Not something to
// be used outside of example code.
Object.defineProperty(Error.prototype, 'message', {
configurable: true,
enumerable: true
});
// This will be a large set of data even for smaller deployments.
console.log(util.format(
'Result: %s',
JSON.stringify(result, null, ' ')
));
if (error) {
console.error(error.message, error.stack || '');
console.error('Update failed.');
}
else {
console.log('Update successful.');
}
});