0.1.8 • Published 8 years ago

ami-motley-tool v0.1.8

Weekly downloads
4
License
Apache-2.0
Repository
github
Last release
8 years ago

AMI Motley Tool

npm version

Utility methods for AMI.

Instration

$ npm install ami-motley-tool

Usase

var AmiMotleyTool = require("ami-motley-tool");
var amt = new AmiMotleyTool();

amt.getSortedGroupImages({ Name: "Foo", Role: "Web Server" }, "BuildNo").then(function(images) {
  ...
}).catch(function(err) {
  console.log(err.stack);
});

amt.createImageAndSnapshotWithTags({ Name: "ami001", InstanceId: "i-123123123" }, function() { console.log("wait for creating AMI..."); }).then(function(imageId) {
  ...
}).catch(function(err) {
  console.log(err.stack);
});

Methods

See source.

Utility Methods

methodarg1arg2arg3returndescription
getTagValuedescription (instance, image, other AWS resources){ Xxx: "yyy", Tags: [ { Name: "foo1", Value: "bar1" }, { Name: "foo2", Value: "bar2" } ] }key"foo1""bar1" (or null)get target tag value from description of image or instance.
covertTagsToMaptags[ { Name: "foo", Value: "bar" }, { Name: "foo2", Value: "bar2" }... ]{ foo: bar, foo2: bar2 }convert tags to map.
getFiltersgroupTag{ foo: "bar", foo2: "bar2" }[ { Name: "tag:foo", Values: [ "bar" ] }, { Name: "tag:foo2", Values: [ "bar2" ] }... ]get filters from group.

AWS Methods

methodarg1arg2arg3returndescription
getGroupImagesgroupTag{ foo: "bar", foo2: "bar2" }Promise(images)get filtered (groupTag) images. groupTag is tag set.
getSortedGroupImagesgroupTag{ foo: "bar", foo2: "bar2" }versionTag"BuildNo"Promise(images)get filtered (groupTag) and sorted (versionTag ASC as string) images. groupTag is tag set.
deleteOldImagesAndSnapshotsgroupTag{ foo: "bar", foo2: "bar2" }versionTag"BuildNo"callbackWaitPromisedelete old images and snapshots in target group. (keep latest one)
getUsedImageIdstargetTag{ foo: "bar", foo2: "bar2" }Promiseget used image IDs in target group. (AutoScalingGroup and EC2 Instance)
deleteUnusedImagesAndSnapshotsgroupTag{ foo: "bar", foo2: "bar2" }targetTag{ foo: "bar", foo2: "bar2" }callbackWaitPromisedelete unused images and snapshots in target group. (AutoScalingGroup and EC2 Instance)
createImageAndSnapshotWithTagsopts(InstanceId and Name required.AWS CreateImage Property)callbackWaitPromise(imageId)create image and snapshots with tags of target instance. Tag keys starting with "aws:" are reserved.
setTagsToImageimageIdtagsPromiseset tags to image.
setTagsToSnapshotimageIdtagsPromiseset tags to snapshot.
waitAvailableAmiimageIdcallbackWaitPromisetrue:AMI launched.false:AMI launch failed.)wait available AMI.
waitUnavailableAmiimageIdcallbackWaitPromisetrue:AMI unavailable.false:error.)wait unavailable AMI.

License

Copyright 2016 t-yamo

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
0.1.8

8 years ago

0.1.7

8 years ago

0.1.6

8 years ago

0.1.5

8 years ago

0.1.4

8 years ago

0.1.3

8 years ago

0.1.2

8 years ago

0.1.1

8 years ago

0.1.0

8 years ago