forked from koding/koding
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmodify
More file actions
executable file
·34 lines (27 loc) · 813 Bytes
/
Copy pathmodify
File metadata and controls
executable file
·34 lines (27 loc) · 813 Bytes
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
#!/usr/bin/env coffee
argv = (require 'minimist') process.argv.slice 2
unless InstanceId = argv['instance-id']
console.error 'error: instance id is not specified'
process.exit 1
unless action = argv.action
console.error "error: action is not specified"
process.exit 1
params =
DryRun: argv['dry-run']
InstanceId: InstanceId
switch action
when 'disableApiTermination'
params.Attribute = 'disableApiTermination'
params.Value = 'true'
when 'enableApiTermination'
params.Attribute = 'disableApiTermination'
params.Value = 'false'
else
console.error "error: illegal attribute is specified"
process.exit 1
AWS = require './aws'
EC2 = new AWS.EC2()
EC2.modifyInstanceAttribute params, (err) ->
if err
console.error "error: #{JSON.stringify err}"
process.exit 1