Skip to content

Commit

Permalink
updated README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
xfanwu committed Sep 17, 2019
1 parent 24905c0 commit a4f513c
Showing 1 changed file with 16 additions and 6 deletions.
22 changes: 16 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,32 @@ https://aws.amazon.com/cli/

https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-welcome.html

## Get instance ID
## Modify {INSTANCE_ID} in `changeIP.js` with yours

`aws ec2 describe-instances | grep InstanceId`
```javascript

## Allocate IP
CONST INSTANCE_ID = {yourInstanceId}

```

## Run the script

`node changeIP.js`

## How it works

### 1. Allocate a new IP address

`aws ec2 allocate-address`

## Associate-address
### 2. Associate the new IP

`aws ec2 associate-address --instance-id i-05338ffd430e8e0e4 --public-ip {NEW_IP}`

## Get old adresses
### 3. Get the old address

`aws ec2 describe-addresses | grep AllocationId`

## Release adress
### 4. Release the old address

`aws ec2 release-address --allocation-id {OLD_IP}`

0 comments on commit a4f513c

Please sign in to comment.