How to Create Elastic IPs on Amazon Web Service(AWS).
An Elastic IP address is a reserved public IP address that you can assign to any EC2 instance in a particular region, until you choose to release it.
The Elastic IP address remains in place through events that normally cause the address to change, such as stopping or restarting the instance.By using an Elastic IP address, you can mask the failure of an instance or software by rapidly remapping the address to another instance in your account.
- Login to aws portal.
- Click on Services.
- Under Compute select EC2.
- Click on Elastic IPs.
- Click on Allocate new address.
- Select Availability zone/Network Border group.
- Select Amazon pool when an IPv4 address to be allocated from Amazon’s pool of IP addresses or Select Owned by me when an IPv4 address to be allocated from a pool created from your on-premises network.
- Click on Allocate.
- New allocate address is ready.
- Click on Actions.
- Select Associate Address.
- We can associate address by using two resource type.
- When select Instance.
- Select Existing Instance ID.
- No need to provide private IP.
- Click on Associate.
- When select Network interface.
- Select existing Network interface.
- Click on Associate.
- Associate address request succeeded.
- Click on close.
- Go to Elastic IP console page.
- Elastic IP association is ready.
- Click on Actions.
- Click on Add/Edit Tags.
- Click on Create Tag.
- Provide key name & value for elastic IP.
Create Elastic IPs using Shell
- Setup aws-cli on your system so click on link https://www.hackerxone.com/blog/how-install-configure-aws-cli-ubuntu-1804
- Run the following command:
aws ec2 allocate-address –domain vpc –network-border-group us-east-1
Associate Elastic IP using Instance Resource type
- To associate an Elastic IP addresses in EC2-Classic.
aws ec2 associate-address –instance-id instance_id –public-ip public_ip_address
- To associate an Elastic IP address in EC2-VPC.
aws ec2 associate-address –instance-id instance_id –allocation-id allocation_id
Associate Elastic IP using Network Interface Resource type
- Associates an Elastic IP address with a network interface.
aws ec2 associate-address –allocation-id allocation_id –network-interface-id network_interface_id
or
- Associates an Elastic IP address with a network interface & Private IP address.
aws ec2 associate-address –allocation-id allocation_id –network-interface-id network_interface_id –private-ip-address private_id_address