mirror of
https://github.com/bigchaindb/bigchaindb.git
synced 2024-10-13 13:34:05 +00:00
Merge pull request #203 from bigchaindb/add-release_eips-script
Put release_eips.py back
This commit is contained in:
commit
e9bc552bb1
43
deploy-cluster-aws/release_eips.py
Normal file
43
deploy-cluster-aws/release_eips.py
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
"""Release all allocated but non-associated elastic IP addresses
|
||||||
|
(EIPs). Why? From the AWS docs:
|
||||||
|
|
||||||
|
``To ensure efficient use of Elastic IP addresses, we impose a small
|
||||||
|
hourly charge if an Elastic IP address is not associated with a
|
||||||
|
running instance, or if it is associated with a stopped instance or
|
||||||
|
an unattached network interface. While your instance is running,
|
||||||
|
you are not charged for one Elastic IP address associated with the
|
||||||
|
instance, but you are charged for any additional Elastic IP
|
||||||
|
addresses associated with the instance. For more information, see
|
||||||
|
Amazon EC2 Pricing.''
|
||||||
|
|
||||||
|
Source: http://tinyurl.com/ozhxatx
|
||||||
|
"""
|
||||||
|
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
import boto3
|
||||||
|
from awscommon import get_naeips
|
||||||
|
|
||||||
|
# Get an AWS EC2 "resource"
|
||||||
|
# See http://boto3.readthedocs.org/en/latest/guide/resources.html
|
||||||
|
ec2 = boto3.resource(service_name='ec2')
|
||||||
|
|
||||||
|
# Create a client from the EC2 resource
|
||||||
|
# See http://boto3.readthedocs.org/en/latest/guide/clients.html
|
||||||
|
client = ec2.meta.client
|
||||||
|
|
||||||
|
non_associated_eips = get_naeips(client)
|
||||||
|
|
||||||
|
print('You have {} allocated elactic IPs which are '
|
||||||
|
'not associated with instances'.
|
||||||
|
format(len(non_associated_eips)))
|
||||||
|
|
||||||
|
for i, eip in enumerate(non_associated_eips):
|
||||||
|
public_ip = eip['PublicIp']
|
||||||
|
print('{}: Releasing {}'.format(i, public_ip))
|
||||||
|
domain = eip['Domain']
|
||||||
|
print('(It has Domain = {}.)'.format(domain))
|
||||||
|
if domain == 'vpc':
|
||||||
|
client.release_address(AllocationId=eip['AllocationId'])
|
||||||
|
else:
|
||||||
|
client.release_address(PublicIp=public_ip)
|
@ -122,9 +122,17 @@ bigchaindb --help
|
|||||||
bigchaindb show-config
|
bigchaindb show-config
|
||||||
```
|
```
|
||||||
|
|
||||||
There are fees associated with running instances on EC2, so if you're not using them, you should terminate them. You can do that from the AWS EC2 Console.
|
There are fees associated with running instances on EC2, so if you're not using them, you should terminate them. You can do that using the AWS EC2 Console.
|
||||||
|
|
||||||
The same is true of your allocated elastic IP addresses. There's a small fee to keep them allocated if they're not associated with a running instance. You can release them from the AWS EC2 Console.
|
The same is true of your allocated elastic IP addresses. There's a small fee to keep them allocated if they're not associated with a running instance. You can release them using the AWS EC2 Console, or by using a handy little script named `release_eips.py`. For example:
|
||||||
|
```text
|
||||||
|
$ python release_eips.py
|
||||||
|
You have 2 allocated elactic IPs which are not associated with instances
|
||||||
|
0: Releasing 52.58.110.110
|
||||||
|
(It has Domain = vpc.)
|
||||||
|
1: Releasing 52.58.107.211
|
||||||
|
(It has Domain = vpc.)
|
||||||
|
```
|
||||||
|
|
||||||
## Known Deployment Issues
|
## Known Deployment Issues
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user