mmi-aws-api
v1.0.11
Published
This will help User to start and stop aws ec2 instance with checking instance existance and whether its switched on or off
Readme
Welcome to MMI AWS API
The main scope of this application is to start & stop aws ec2 instance. Where before start the instance we check the status of instance whether its available or not and do with respect to it.
Installation
$ npm install mmi-aws-apiUsage
copy below code to start ec2 instance inside index.js
var awsMMIApi = require('mmi-aws-api');
var instanceId = "blah";
var region = "blah";
var debug = false;
awsMMIApi.startInstance(instanceId,region,debug,function (response) {
console.log(response);
});copy below code to stop ec2 instance inside index.js
var awsMMIApi = require('mmi-aws-api');
var instanceId = "blah";
var region = "blah";
var debug = false;
awsMMIApi.stopInstance(instanceId,region,debug,function (response) {
console.log(response);
});copy below code to check status ec2 instance inside index.js
var awsMMIApi = require('mmi-aws-api');
var instanceId = "blah";
var region = "blah";
var debug = false;
awsMMIApi.instanceStatus(instanceId,region,debug,function (response) {
console.log(response);
});then run
node index.jsPrerequisites
- At AWS >> IAM >> add new user >> give permission to start, stop instance
- Get the secret key & access key
- Copy below commands in terminal
which python
python --version
pip --version
sudo apt install python-pip
pip install --user awscli
which aws
aws configureNote: Here it will ask access key, secret key & region. Check reference (1) video for this steps
