When we create an EC2 instance, we should get a public IP address(which is dynamic) and one private address which is static in nature. Public ip address is used to broadcast your internet connected device to the internet and private ip address is the address of the machine which uniquely identifies it.
Now the problem here is, when we reboot the instance, the public IP address keeps on changing. Thus it will be a problematic situation for your applications to work. There is a way through which you can make the public IP4 address as static. This is achieved via Elastic ip address.
Below are the steps through which we can associate an Elastic IP address to an EC2 instance.
now if we reboot the ec2 instance, the public ip address will change. Note:Private ip address remain static.
Now the problem here is, when we reboot the instance, the public IP address keeps on changing. Thus it will be a problematic situation for your applications to work. There is a way through which you can make the public IP4 address as static. This is achieved via Elastic ip address.
Below are the steps through which we can associate an Elastic IP address to an EC2 instance.
now if we reboot the ec2 instance, the public ip address will change. Note:Private ip address remain static.
From the above ip address, once we are connected to instance
via public ip address, we should be able to see the address of the machine
which is the private address.
In order to prevent the public ip address from changing,
associate it with the elastic ip address.
Now associate the elastic address to the ec2 instance
Click on actions:-
Now
if we go to the ec2 console, we will have a new public ipv4 address
This ip address will not change even if we reboot the instance.
Happy learning..............