AWS - How to Assign an Elastic IP address to your EC2 Instance

AWS - How to Assign an Elastic IP address to your EC2 Instance


AWS - How to Assign an Elastic IP address to your EC2 Instance

Hello Guys,

Lets start the video on AWS - How to Assign an Elastic IP address to your EC2 Instance

On this video we will see how to assign an Elastic IP addresses to our Instance and why it is required.

An advantage of using Amazon Elastic Compute Cloud (EC2) is the ability to start, stop, create, and terminate instances at any time.

If you don’t want to lose your public IP address, then you must have to associate an Elastic IP address with your intance so whenever you stopped the instance it will not not changed the public IP address and your instance can be communicate with the internet with the same Elastic IP Address even after restart the instance. This can also allows to connect to your instance from your local computer as well.

An Elastic IP provides you a single IP address that you can associate with different EC2 instances over time. If your EC2 instance has an Elastic IP and that instance is ever stopped or terminated, you can immediately associate a new EC2 instance with the Elastic IP.

If you ever need to stop an instance, you should reassociate it with its Elastic IP after you start the instance again. You can even associate the Elastic IP with a backup instance while the other instance is down.

To allocate an Elastic IP and associate it with an Amazon Web Services (AWS) instance, do the following:

Open the AWS Management Console, click the EC2 link, and display the page associated with your region.

Click the Elastic IPs link in the EC2 Dashboard.

Click Allocate New Address and choose EC2 from the drop-down list, depending whether you’re going to associate this IP with an instance in Amazon EC2-

Amazon EC2 respectively. Click Yes, Allocate to confirm your choice. Right-click the newly created Elastic IP and choose Associate Address.

Choose your desired EC2 instance from the drop-down list of running instances and click Associate.

If you like this video, please share it, comments and subscribe to this channel. Please ring that bell to get the latest video notification and see you on my next video.

#AWSElasticIPAddress, #Elasticipaddresses, #EC2Instance #assignelasticipaddress #EC2ElasticIPAddress, #AWSTutorial, #AWSTraining, #AWSSolutionArchitectAssociate, #AWS, #Amazonwebservice, #Cloudcomputing, #awsblog, #awscommunity, #elasticip, #awscertified, #SystemAdministrator, #ITSupport, #ITTeams, #IT, #Windows, #NetworkAdministrator, #TechnTechie, #Technology, #Technology, #techntechie #technologytips #technology, #newtechnology, #informationtechnology, #informationtechnologybasics, #informationtechnologyjobs, #informationtechnologycareers, #systemadministrator, #systemadministratordayinthelife, #systemadministratorjob, #networkadministrator, #networkengineer, #itsupport, #itsupportspecialist, #AWStrainingvideo,

It’s All About The Technology


Content

0.75 -> Welcome Back
1.98 -> On this video we will see how to assign an Elastic IP address to our Instance
6.71 -> And Why it is required.
8.98 -> First of all we would like to know what is an Elastic IP address. It is a static IPv4
15.059 -> address designed to dynamic cloud computing and is allocated to your AWS account.
21.46 -> You can attach it to one instance at a time and it
24.92 -> is yours until you release it or delete it.
28.68 -> It is also a public IP Address, which is reachable from the internet.
33.98 -> By using an Elastic IP address, you can mask the failure of an instance or software by
39.91 -> rapidly remapping the address to another instance in your account.
45.149 -> If you don't want to lose your public IP address, then you must have to associate an Elastic
50.7 -> IP address with your instance so whenever you stopped the instance it will not changed
56.18 -> the public IP address and your instance can be communicate with the internet with the
61.489 -> same Elastic IP Address even after restart the instance. This can also allows to connect
67.64 -> to your instance from your local computer as well.
71.11 -> One important thing is that currently Amazon does not support Elastic IP addresses for
76.05 -> IPv6.
77.15 -> An Elastic IP Address is for use in a specific Region only, and cannot be moved to a different
84.79 -> Region.
86.27 -> As you can see here, the Linux Server instance state is stopped right now and here below
92.369 -> the public IP address is not present because it is stopped.
96.66 -> Here you can see that it has private IP Address but not a public IP Address.
102.37 -> Now, we will start the Linux instance and will wait to see the Instance State is Running,
110.649 -> yes it is started and up now.
115.182 -> Now We can see here it has Public IP address that is 13.233.215.171 and the Private IP
125.98 -> address is the same.
127.61 -> Ok
128.61 -> Just scroll down little bit and can see that it doesn't have an Elastic IP Address.
134.45 -> Why we need it, before going to add this would like to show you on this demo.
140.06 -> Let start the PowerShell and will connect the instance by running SSH command and for
145.91 -> that we required the key file that is pem file, which we have downloaded in downloads
151.95 -> folder.
152.95 -> First will go to the downloads folder in PowerShell and yes before this we need to copy the .pem
160.03 -> file name from the downloads folder and paste here to complete this command.
167.434 -> ssh -i LinuxServer.pem ec2-user@ and the public IP Address which we will get here in Instance,
179.099 -> just copy it from here and paste it and hit the enter to run this command.
186.29 -> it is asking are you sure you want to continue connecting yes or no, will go for yes and
193.099 -> hit the enter
194.099 -> yeah, we are now in AWS Linux Instance, right. Till here all good right now. No doubt! Great
203.019 -> Now what we will do, we will go to stop this Instance and see what happen. The Public IP
209.349 -> Address will be gone, it will disappear from here when the instance will in stopped state.
215.489 -> Just note down this IP Address and see when we restart the same instance then the Public
221.621 -> IP
222.621 -> Address will be changed.
223.621 -> As you can see here the IP Address in PowerShell, let see now.
227.86 -> Reload it to get the current status, it is still same.
232.31 -> Reload the browser now, hope it will show us the correct status.
238.09 -> Yes, it is stopped now. See below in Details that Public IP Address is nothing here.
245.64 -> Now we will go to start this Instance and see this ip will get changed.
252.11 -> Reload the browser and yes it is running and the Public IP Address is changed.
258.258 -> It is now 13.126.165.36
263.5 -> The problem is that whenever we are going to SSH our instance after restart it, every
269.79 -> time we have to provide the new IP Address. Otherwise it will not going to connect your
275.01 -> instance if you don't know that your instance restarted.
278.77 -> So, copy this new ip address and use it now in our PowerShell command.
284.59 -> Before going to provide the new ip address we'll run the same command with old IP Address
289.51 -> to check that's work or not.
291.87 -> No, it is not.
293.42 -> Now change the IP Address and enter here the new one and hit the enter
298.31 -> it is asking the same that are you sure to continue to connect this instance yes or no,
305.41 -> of course will go for yes, yes I want to connect.
308.639 -> See, it is connected successfully.
311.83 -> If we don't want this kind of problem then in that case we can add an Elastic IP Address
317.46 -> and attach the same to this Instance to fix the IP Address.
321.02 -> Let see how we can do this.
323.87 -> In the left pane, under Network & Security. Go for Elastic IPs click on it.
331.06 -> The new window will open and which shows Allocate Elastic IP Address.
337.009 -> So I will click on it and here we are in Elastic IP Address settings page.
342.669 -> By default only from Amazon pool of IPv4 addresses we will get the Elastic IP Address.
350.419 -> Now we will go to click on Allocate.
352.479 -> Here we get the Elastic IP Address 3.109.174.167 can see the Type and Allocation ID.
364.66 -> We will go on Actions tab and click on Associate Elastic IP Address, here we are in new windows
371.05 -> again to choose the type of resource with which we want to associate this Elastic IP Address.
378.11 -> We have here Instance so will go with this and will choose the running Instance from
383.039 -> here. I know that I have tagged the instance name as Linus Server and even it is showing
389.08 -> that it is running.
390.389 -> I will choose the running Linux Instance and the Private IP Address with which to associate
396.449 -> the Elastic IP Address.
398.259 -> And now we will go to click on Associate.
401.61 -> We will move to the Instances now to check that Elastic IP Address is associated with
407.99 -> our Linux instance.
409.93 -> Yeah Guys. As we can see that the new Elastic IP address is assigned and associated with
415.539 -> this and can see in Public IP Address and here in Elastic IP Address as well and marked
422.509 -> as Public IP Address. Alright
426.33 -> We will go back on our PowerShell to run the SSH command with new Elastic IP Address.
432 -> And run the command ssh -i linuxserver.pem ec2-user so copy this IP Address first and
442.61 -> paste the copied IP Address here and hit the enter.
447.05 -> It is asking the same so go for yes and here we are into the Linux Instance. All good here.
454.18 -> Let me show you one more important thing, as before associate and Elastic IP Address
459.34 -> to this instance, when we stopped the instance the Public IP address also removed, right
465.34 -> and get the new one after restarted the instance.
468.5 -> Now, we will go to stop this instance and will see this IP Address also removed or not.
474.509 -> Refresh or reload the browser to get the current status. Yes, the instance is completely stopped
480.96 -> and can see that we still have the same IP Address, it is not gone. This is main feature
487.129 -> of and Elastic IP Address. Once it is associated with the AWS account or with an Instance and
494.9 -> it is yours as long as you don’t delete it but take care of costing too because it
500.75 -> will charge you as well.
502.66 -> I don't need it so would like to Disassociate Elastic IP address now.
508.34 -> As it is showing here that this Elastic IP address is associated with this Instance ID
514.7 -> and the Network Interface ID.
516.479 -> Anyway, click on Disassociate to go for the next step.
521.86 -> Now it is disassociated and will go to release this as well, don't forget to release this.
528.11 -> Okay!
529.11 -> it will ask you if you release the following Elastic IP Addresses, then it not longer be
534.22 -> allocated to your account and can no longer associate with your resources.
539.26 -> Anyway, Release it.
541.87 -> it is successfully released and will go back to our Instance page and cross check there.
547.13 -> Yes. It is released as we can see here is not an IP Address.
551.43 -> What is this? here it is still live in Elastic IP Address, let me reload this one more time.
560.209 -> Yeah, it is gone now. Nothing is here too.
564.08 -> Now start the Instance again to check which IP Address we will get here.
569.68 -> Reload it and there we got the new Public IP Address. You can cross check one more time
575.54 -> the Elastic IP address is not here.
577.98 -> Okay Guys, You have seen how to allocate the new Elastic IP Address and attached with an
585.019 -> instance so that the public IP Address will be fixed even after stopped and restarted
589.899 -> the instance.
590.899 -> I am going to end this video here, See you all on my next video till then have a great
595.85 -> day and bye bye.

Source: https://www.youtube.com/watch?v=RKkkeEGxlow