Attach and Detach Public IP in AWS

This script is used for detach elastic ip from one server and attach it to the secondary private ip of the other server.

For example:-

We have two servers with same content named “server01” and “server02” with primary and secondary private IP in AWS and each instance have a public IP  (ie. Elastic IP). This two public IP’s are pointed to the DNS.

If “server01” goes down, only you need to detach the elastic IP and attached it to the “server02” to the secondary private IP.

You can find the script in the below link:-








Simple Nodejs WebServer

Node.js is built on Chrome’s V8 JavaScript Engine. It’s useful for a range of applications and it brings JavaScript to the server. Applications written in Node.js are event-driven. For example, if you wanted to create a file, you would provide a callback function to be called upon the file’s successful creation. In this sort of model, your app doesn’t become stuck waiting for events to finish executing.

I hope you have installed nodejs. Then you need to install “forever”

Installing forever

forever, developed by nodejitsu, has functions to create applications that are always running—”forever” running. If the application dies, forever brings it back. It has built-in functionality to monitor processes. It also offers an API you can use to incorporate its features into your own code.

forever can be installed using npm. npm should have been installed as part of Node.js:


Running the app

Create the file index.js with the following contents:


Then run:


Point your browser to or http://localhost. It should display the index.html”

Now we can use forever to manage our application:, instead of running the above command.


To check, open the browser and point it to the or http://localhost. It should display the index.html

Stopping the app is similar: