How can I associate a static public IP address with my EC2 Windows or Linux instance or network interface?
The auto-assigned public IP address associated with my Amazon Elastic Compute Cloud (Amazon EC2) instance changes every time I stop and start the instance.
Short description
An Elastic IP address is a static public IPv4 address associated with your AWS account in a specific Region. Unlike an auto-assigned public IP address, an Elastic IP address is preserved after you stop and start your instance in a virtual private cloud (VPC).
You can use these tools to associate an Elastic IP address with your EC2 instance:
- The Amazon EC2 console
- The AWS Command Line Interface (AWS CLI)
- AWS Tools for Windows PowerShell
Note: If you receive errors when you run AWS CLI commands, see Troubleshoot AWS CLI errors . Also, make sure that you're using the most recent AWS CLI version .
Static IP addresses have these limitations:
- You can't use an auto-assigned public IP address to retain or reserve the current public IP address assigned to the instance.
- You can't convert an auto-assigned public IP address to an Elastic IP address.
Note: The default quota for Elastic IP addresses is 5 per Region per AWS account. For more information about quotas and how to request an increase, see Elastic IP address quota .
To allocate and associate an Elastic IP address with your EC2 Windows or Linux instance or network interface, follow these steps:
- Allocate an Elastic IP address from either Amazon's pool of public IPv4 addresses or bring your own IP addresses (BYOIP) to your AWS account.
- Associate the Elastic IP address with an instance or network interface.
You can also disassociate an Elastic IP address, and then re-associate it with a different instance.
Related information
How can I assign a static IP address to my Amazon EC2 Windows instance?
Elastic IP addresses
Amazon EC2 instance IP addressing
Stop and start your instance
Related videos
Relevant content
- Public Endpoint IP addresses static or dynamic? dotmindlabs lg ... asked 2 years ago lg ...
- Cannot associate the Elastic IP address with a Network interface rePost-User-3071397 lg ... asked 7 months ago lg ...
- how make my default public ip to static ip in ec2 instance ? Linuxnoob lg ... asked 7 months ago lg ...
- Static IP address for EC2 Instance ses2 lg ... asked 4 years ago lg ...
- Can an Alexa Skill Lambda function have a static public IP address? justinH lg ... asked a year ago lg ...
DEV Community
Posted on Jun 22, 2022
How to Add a Static IP to an AWS EC2 Instance
Introduction.
AWS Elastic Compute Cloud (EC2) is a popular option for cloud computing services. It offers virtual servers (or instances) as well as security, networking, and storage options. EC2 can launch as many or as few virtual servers as you need, depending on your projects.
Using EC2 offers multiple benefits, including the ability to run your applications in the cloud and to create virtual machines (VMs) with whatever configurations you might need. The infrastructure is scalable, with over 500 instances, and EC2 supports developing macOS and machine learning applications.
EC2 works with static (aka elastic) IP addresses. Whenever a resource on a network is assigned an IP address, that IP address is either dynamic—meaning it’s assigned by the network it’s connected to and changes periodically—or static, meaning it never changes. An elastic IP address in EC2 is public, so it’s reachable from the internet. Because it’s set to your AWS account, an elastic IP address can be remapped to another instance as needed in case of bugs or other issues. A custom IP address can also be added to your account rather than use one from AWS.
Elastic IP addresses are provided via a Dynamic Host Configuration Protocol (DHCP). These IP addresses are persistent, meaning they will not change when the VM is restarted or shut down.
In this tutorial, I'll walk you through how to configure an elastic IP address with an AWS EC2 instance.
Prerequisites
This article doesn't have many prerequisites, it is a tutorial which will assume you already have an AWS EC2 instance provisioned already, that is ready to be associated with an elastic IP address. In case you do not already have an AWS EC2 instance running, please create one before proceeding with the rest of this guide.
Let's dive right in!
Step 1: Choosing Elastic IP
From the AWS console, navigate to EC2 by clicking Compute . This should take you straight to your EC2 dashboard.
On your dashboard, click on Elastic IPs under Network & Security .
Step 2: Creating New IP
Click on Allocate Elastic IP address to create a new static IP address.
Proceed by clicking Allocate .
Step 3: Assigning IP to EC2 Instance
Once the allocation request is successful, assign the static IP to your EC2 instance.
On the elastic IP view, select the IP you just allocated and click the Actions dropdown.
Select the View details button to reveal the info page on the elastic IP.
On this page, click the Associate Elastic IP address button.
Step 4: Associating IP to Instance
Search for your instance ID from the Instance field.
Select the instance ID and scroll down to click the Associate button.
Step 5: Checking The Instance View
Your elastic IP address has now been associated with your EC2 instance. Head to your instance view by clicking on your instance ID. The address of your static IP is now displayed on the view.
Step 6: Connecting to The Instance
Connect to your EC2 instance with the newly associated static IP. On your instance view, click Connect . A view with connection details can now be seen. If you’re using a Linux or Mac system, open up your terminal.
Select SSH on the connect view. This tutorial connects via SSH through PowerShell.
Set permissions on private key if you haven’t already by pasting one of the below commands in your terminal or CLI:
Option A: Linux
Option B: Windows (PowerShell)
You can copy-paste the second command shown on your instance description to connect to your remote instance:
Enter Yes to proceed.
The instance is now connected, as shown below, this was validated by confirming the present working directory with the command pwd . Please proceed with building whatever solution you want to deploy on your EC2 instance.
Limits on Elastic IPs
According to this AWS documentation on service quotas, “Your AWS account has default quotas, formerly referred to as limits, for each AWS service.” The important thing to understand is that static IPs on EC2 instances have a limit of five IPs per region per account, so you can’t allocate more than five static IPs in the same AWS region. If you already have up to five elastic IPs, you can either delete one or select a new AWS region before allocating a new IP.
If you need to confirm your elastic IP address limit, head over to your EC2 dashboard. Select Limits from the left pane and type in IP in the search box. You should immediately see the EC2-VPC Elastic IPs limit. Click on it for more details about the limit quota.
Remember, the good thing about elastic IPs is they don’t change or expire, unless they are disassociated from an instance and released.
Request an increase to your quota from the Service Quotas Console if the need arises.
In this tutorial, you learned how to set up an elastic IP address and connect it remotely with your AWS EC2 instance. As you saw, this is a simple process that gives you more control over your EC2 instance and allows you to choose your own IP address for as long as you need it.
If you have any questions, feel free to reach out to me on Twitter: @ John Doe or LinkedIn
Top comments (0)
Templates let you quickly answer FAQs or store snippets for re-use.
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink .
Hide child comments as well
For further actions, you may consider blocking this person and/or reporting abuse
How to mock an API in 2 minutes
Lucy Linder - May 9
Solving a Leetcode problem daily — Day 9 | First Bad Version
Subhradeep Saha - May 9
Best Practices for Naming REST API Endpoints
Spencer Nguyen - May 9
What Is Cross-Site Scripting (XSS) and How Does It Work?
CloudDefense.AI - May 9
We're a place where coders share, stay up-to-date and grow their careers.
How-To Geek
What are aws elastic ips, and what do they do.
AWS Elastic IPs are permanently reserved IP addresses that you can associate with a running EC2 instance, and that persist across reboots and even server changes, so you won't have to change your DNS whenever your server restarts.
Quick Links
What are elastic ips how much do they cost, how to provision an elastic ip, working with elastic ips from the command line.
AWS can't assign a static reserved IP address to every running EC2 instance. Instead, the machine's public IP address is, by default, temporary. When you turn the machine off, that address is available for others to use, and you won't have the same IP when you turn it back on.
This can be a problem, because if you link your domain name to the public IP, your domain name will break whenever you restart your server. You shouldn't have to change your DNS on every restart, so the solution is an Elastic IP address , which never changes.
When you can associate the Elastic IP to a machine, the public IP for that machine is replaced by the Elastic one. The associated address is attached to the instance itself; If the instance turns off, the elastic IP stays where it is, and reattaches to the instance when it turns back on. If you need to upgrade, switch, or replace your server, you can reassociate the address to a new instance, hence Elastic IP. But, it achieves the same effect as having a static IP address for your server.
Elastic IP is a free service, but you're limited to five in total (to prevent exhaustion of Amazon's address pool). And, while they are entirely free to use, they're actually the only AWS service that costs money if you don't use it---having an Elastic IP provisioned but not attached to a running machine will cost you $7.50 a month. Make sure your machine isn't off for extended periods of time, and if you change servers or stop using the IP, make sure to release it so you aren't charged for letting it sit idle in your account.
If you're using AWS Load Balancers , you won't want to use Elastic IPs, as your gateway address (the last endpoint before going out to the internet) is be the Load Balancer itself, which has a static hostname (but not a static IP). The load balancer runs on AWS, and you associate it with instances based on their instance IDs, not the public IP address. But, if you're using an external CDN service like Fastly , you need to use Elastic IPs, as the gateway IP is the EC2 instance's public IP.
Elastic IPs are provisioned just like any other AWS service. You can find them in the EC2 Management Console, under the "Elastic IPs" tab:
Create a new address with the "Allocate new address" button. You can provision an address in Amazon's address pool (they own all of
, so it's in that block) or, if you own your own IPv4 block, you can actually use your own address space on AWS .
That's all that's required to create an Elastic IP address, but you also need to associate the address with a running instance. Right click the address in the list, and click "Associate Address." You'll be asked for the instance ID or network interface of the instance you want to assign the address to.
Associating the Elastic IP will detach the current public IP, so you must switch everything to this new IP.
You can allocate a new address with:
aws ec2 allocate-address
Release addresses with:
aws ec2 release-address [allocation-id]
And, list your currently used addresses with:
aws ec2 describe-addresses
If you want to get the allocation ID to associate the address with an instance, pipe it to jq :
aws ec2 describe-addresses | jq '.Addresses[0].AllocationId'
And, use the associate-address command to link it:
aws ec2 associate-address
--allocation-id [string]
--instance-id [string]
For further information, you can consult the CLI command reference .
EC2 Static IP Addresses
Ip addresses on ec2.
Every EC2 instance has two IP addresses - the real one on its eth0 interface (typically in the 10.0.0.0/8 network), and an external Internet-accessible address. The Amazon using NAT to foward all traffic to the external address to the internal one, and back again for outgoing connections.
Both addresses are dynamically assigned when a system is created. Because an EC2 instance may need to be destroyed and re-created, there is no guarantee that a replacement instance will get the same IP address that a previous system did, even one under the same account.
However, Amazon does allow EC2 accounts to request static IP addresses, which they call Elastic IPs. Each static IP can be associated with a single EC2 instance at a time, and can be moved between instances. This allows you to keep your external addresses consistent in the face of virtual system creation and deletion.
Creating and Managing Static Addresses
To request a new static EC2 address, follow these steps :
- Login to Cloudmin, and go to Amazon EC2 -> EC2 Static IP Addresses .
- Select an EC2 account from the menu at the bottom of the page (if you have more than one), and click the Allocate New Address button.
- If all goes well, the new IP will show up in the list on the same page.
Amazon bills for each static IP address associated with your access, so don't request too many of them!
To give back an address, check the box next to it and click the Return Selected IP Addresses button. Be careful doing this, as you will not be able to request the same address again. Only addresses not assigned to any system can be returned.
Assigning a Static Address
Once an address has been requested, you can assign it to an EC2 system as follows :
- Select the system from the left menu, and go to System Operations -> Assign EC2 Address .
- Select the address from the IP address to assign menu, and click Update IP Address .
- Wait for Cloudmin to detect that the new address has been applied. This may take several minutes.
You can also dis-associate an address from a system on the same page, by selecting <None> from the IP address to assign menu.
Using Elastic IP addresses in Amazon EC2 #
This Python example shows you how to:
Get descriptions of your Elastic IP addresses
Allocate an Elastic IP address
Release an Elastic IP address
The scenario #
An Elastic IP address is a static IP address designed for dynamic cloud computing. An Elastic IP address is associated with your AWS account. It is a public IP address, which is reachable from the Internet. If your instance does not have a public IP address, you can associate an Elastic IP address with your instance to enable communication with the Internet.
In this example, Python code performs several Amazon EC2 operations involving Elastic IP addresses. The code uses the AWS SDK for Python to manage IAM access keys using these methods of the EC2 client class:
describe_addresses .
allocate_address .
release_address .
For more information about Elastic IP addresses in Amazon EC2, see Elastic IP Addresses in the Amazon EC2 User Guide for Linux Instances or Elastic IP Addresses in the Amazon EC2 User Guide for Windows Instances . Prerequisite Tasks
All the example code for the Amazon Web Services (AWS) SDK for Python is available here on GitHub .
Prerequisite tasks #
To set up and run this example, you must first configure your AWS credentials, as described in Quickstart .
Describe Elastic IP addresses #
An Elastic IP address is a static IPv4 address designed for dynamic cloud computing. An Elastic IP address is associated with your AWS account. With 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.
The example below shows how to:
Describe Elastic IP addresses using describe_addresses .
Allocate and associate an Elastic IP address with an Amazon EC2 instance #
Acquire an Elastic IP address using allocate_address .
Release an Elastic IP address #
After releasing an Elastic IP address, it is released to the IP address pool and might be unavailable to you. Be sure to update your DNS records and any servers or devices that communicate with the address. If you attempt to release an Elastic IP address that you already released, you’ll get an AuthFailure error if the address is already allocated to another AWS account.
Release the specified Elastic IP address using release_address .
- Privacy Policy
How to Assign an Elastic IP address to your EC2 Instance in AWS
How to Assign an Elastic IP address to your EC2 Instance in AWS. In this guide you are going to learn the importance and necessary of Elastic IP address and how to assign it to your EC2 Instance.
The Elastic IP should be assigned to an instance, if it is not assigned you may incurr additional billing for idle time usage. So if you have any unassigned Elastic IP address, make sure to remove them.
Once you create a new EC2 Instance your instance will get a new public IP address. But this IP address is not static so it will change or a new IP will get assigned to your instance when certain actions are made on your instance like restarting your instance.
If you have your public IP address configured in your DNS A record, that particular IP address can change anytime. So when a new IP address is assigned to your instance your visitor cannot see your website because it points to the old IP address which you don’t have control anymore.
To overcome this issue Elastic IP comes in which is a static IPv4 address designed for dynamic cloud computing. With the Elastic IP you can rapidly remap the address to any instance in your account.
Prerequisites
- A running EC2 Instance. Learn how to create an AWS EC2 instance .
Create Elastic IP address
Login to your AWS management console and navigate to Compute >> EC2 and under Network and security click Elastic IPs.
In this screen click Allocate Elastic IP address .
Now a new IPv4 address will get allocated.
Associate Elastic IP address
Once an IP is allocated you need to associate it with the EC2 Instance.
To do so check the checkbox of your IP address and click Actions and choose Associate Elastic IP address .
In the Resource type choose Instance and and choose the instance from the dropdown on the Instance field.
If you have any other Elastic IP address assigned before and you need to re-associate you can enable the checkbox in Reassociation
Click Associate .
Release Elastic IP address
If you wish to no longer use the allocated IP address you can release it to prevent any unnecessary billings.
To do so check the checkbox of your IP address and click Actions and choose Release Elastic IP address .
Become a Certified AWS Professional with this easy to learn course now.
Now you have learned how to allocate, associate and release Elastic IP address AWS.
Thanks for your time. If you face any problem or any feedback, please leave a comment below.
Please Join Our Community
Be a part of the great AI Community and stay updated with the latest AI News
Leave your Reply
Your email address will not be published. All fields are required *
Stay Connected
You may like.
8 Most Popular SSH Clients for Linux in 2024
How to Troubleshoot Linux Network Performance Issues
Node.js 21: What's New and Why You Should Upgrade
How to Fix Windows 10 Sleep Mode Issues in 5 Easy Steps
How to Install Waifu Diffusion - Step-by-Step Guide
Change the hostname of your AL2 instance
When you launch an instance into a private VPC, Amazon EC2 assigns a guest OS hostname. The type of hostname that Amazon EC2 assigns depends on your subnet settings. For more information about EC2 hostnames, see Amazon EC2 instance hostname types in the Amazon EC2 User Guide for Linux Instances .
A typical Amazon EC2 private DNS name for an EC2 instance configured to use IP-based naming with an IPv4 address looks something like this: ip-12-34-56-78.us-west-2.compute.internal , where the name consists of the internal domain, the service (in this case, compute ), the region, and a form of the private IPv4 address. Part of this hostname is displayed at the shell prompt when you log into your instance (for example, ip-12-34-56-78 ). Each time you stop and restart your Amazon EC2 instance (unless you are using an Elastic IP address), the public IPv4 address changes, and so does your public DNS name, system hostname, and shell prompt.
This information applies to Amazon Linux. For information about other distributions, see their specific documentation.
Change the system hostname
If you have a public DNS name registered for the IP address of your instance (such as webserver.mydomain.com ), you can set the system hostname so your instance identifies itself as a part of that domain. This also changes the shell prompt so that it displays the first portion of this name instead of the hostname supplied by AWS (for example, ip-12-34-56-78 ). If you do not have a public DNS name registered, you can still change the hostname, but the process is a little different.
In order for your hostname update to persist, you must verify that the preserve_hostname cloud-init setting is set to true . You can run the following command to edit or add this setting:
If the preserve_hostname setting is not listed, add the following line of text to the end of the file:
To change the system hostname to a public DNS name
Follow this procedure if you already have a public DNS name registered.
For AL2: Use the hostnamectl command to set your hostname to reflect the fully qualified domain name (such as webserver.mydomain.com ).
For Amazon Linux AMI: On your instance, open the /etc/sysconfig/network configuration file in your favorite text editor and change the HOSTNAME entry to reflect the fully qualified domain name (such as webserver.mydomain.com ).
Reboot the instance to pick up the new hostname.
Alternatively, you can reboot using the Amazon EC2 console (on the Instances page, select the instance and choose Instance state , Reboot instance ).
Log into your instance and verify that the hostname has been updated. Your prompt should show the new hostname (up to the first ".") and the hostname command should show the fully-qualified domain name.
To change the system hostname without a public DNS name
For AL2: Use the hostnamectl command to set your hostname to reflect the desired system hostname (such as webserver ).
For Amazon Linux AMI: On your instance, open the /etc/sysconfig/network configuration file in your favorite text editor and change the HOSTNAME entry to reflect the desired system hostname (such as webserver ).
Open the /etc/hosts file in your favorite text editor and change the entry beginning with 127.0.0.1 to match the example below, substituting your own hostname.
You can also implement more programmatic solutions, such as specifying user data to configure your instance. If your instance is part of an Auto Scaling group, you can use lifecycle hooks to define user data. For more information, see Run commands on your Linux instance at launch and Lifecycle hook for instance launch in the AWS CloudFormation User Guide .
Change the shell prompt without affecting the hostname
If you do not want to modify the hostname for your instance, but you would like to have a more useful system name (such as webserver ) displayed than the private name supplied by AWS (for example, ip-12-34-56-78 ), you can edit the shell prompt configuration files to display your system nickname instead of the hostname.
To change the shell prompt to a host nickname
Create a file in /etc/profile.d that sets the environment variable called NICKNAME to the value you want in the shell prompt. For example, to set the system nickname to webserver , run the following command.
Open the /etc/bashrc (Red Hat) or /etc/bash.bashrc (Debian/Ubuntu) file in your favorite text editor (such as vim or nano ). You need to use sudo with the editor command because /etc/bashrc and /etc/bash.bashrc are owned by root .
Edit the file and change the shell prompt variable ( PS1 ) to display your nickname instead of the hostname. Find the following line that sets the shell prompt in /etc/bashrc or /etc/bash.bashrc (several surrounding lines are shown below for context; look for the line that starts with [ "$PS1" ):
Change the \h (the symbol for hostname ) in that line to the value of the NICKNAME variable.
(Optional) To set the title on shell windows to the new nickname, complete the following steps.
Create a file named /etc/sysconfig/bash-prompt-xterm .
Make the file executable using the following command.
Open the /etc/sysconfig/bash-prompt-xterm file in your favorite text editor (such as vim or nano ). You need to use sudo with the editor command because /etc/sysconfig/bash-prompt-xterm is owned by root .
Add the following line to the file.
Log out and then log back in to pick up the new nickname value.
Change the hostname on other Linux distributions
The procedures on this page are intended for use with Amazon Linux only. For more information about other Linux distributions, see their specific documentation and the following articles:
How do I assign a static hostname to a private Amazon EC2 instance running RHEL 7 or Centos 7?
To use the Amazon Web Services Documentation, Javascript must be enabled. Please refer to your browser's Help pages for instructions.
Thanks for letting us know we're doing a good job!
If you've got a moment, please tell us what we did right so we can do more of it.
Thanks for letting us know this page needs work. We're sorry we let you down.
If you've got a moment, please tell us how we can make the documentation better.
COMMENTS
An Elastic IP address is a static public IPv4 address associated with your AWS account in a specific Region. Unlike an auto-assigned public IP address, an Elastic IP address is preserved after you stop and start your instance in a virtual private cloud (VPC). You can use these tools to associate an Elastic IP address with your EC2 instance:
Link-local addresses are well-known, non-routable IP addresses. Amazon EC2 uses addresses from the link-local address space to provide services that are accessible only from an EC2 instance. These services do not run on the instance, they run on the underlying host. When you access the link-local addresses for these services, you're ...
An Elastic IP address is a static IPv4 address designed for dynamic cloud computing. An Elastic IP address is allocated to your AWS account, and is yours until you release it. 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.
Skip directly to the demo: 0:32For more details, see the Knowledge Center article associated with this video: https://repost.aws/knowledge-center/static-priv...
Step 3: Assigning IP to EC2 Instance. Once the allocation request is successful, assign the static IP to your EC2 instance. On the elastic IP view, select the IP you just allocated and click the Actions dropdown. Select the View details button to reveal the info page on the elastic IP. On this page, click the Associate Elastic IP address button.
An Elastic IP address is a static, public IPv4 address designed for dynamic cloud computing. You can associate an Elastic IP address with any instance or network interface in any VPC in your account. With an Elastic IP address, you can mask the failure of an instance by rapidly remapping the address to another instance in your VPC.
Skip directly to the demo: 0:31For more details see the Knowledge Center article with this video: https://repost.aws/knowledge-center/ec2-associate-static-pu...
We just added three important new features to Amazon EC2: Elastic IP Addresses, Availability Zones, and User Selectable Kernels.The documentation, the WSDL, the AMI tools, and the command line tools have been revised to match and there's a release note as well.. Read on to learn all about them… The Elastic IP Addresses feature gives you more control of the IP addresses associated with your ...
So, if you are using an AWS EC2 instance for web services, it needs to have a static IP address. Step 1: Login to your AWS account, choose EC2 service and select Network&Security. Step 3: Click on ...
8. You need to look at AWS VPC for this. Whilst VPC is free outside of the usual instance pricing, it doesn't work with Micro instances (the cheapest ones). When not using VPC, you're assigned IP addresses through DHCP. When the DHCP lease expires, or you restart, your IP is released back to the pool. VPC lets you use private IP addressing, you ...
Find Public IP address AWS EC2 or Lightsail VM. Open the terminal application and login using ssh: $ ssh ec2-user@my-aws-instanace-name. To get public IPv4 address assigned by the AWS for EC2/Lightsail vm, run: $ dig +short myip.opendns.com @resolver1.opendns.com OR $ dig TXT +short o-o.myaddr.l.google.com @ns1.google.com. You should see your ...
AWS can't assign a static reserved IP address to every running EC2 instance. Instead, the machine's public IP address is, by default, temporary. ... as the gateway IP is the EC2 instance's public IP. How to Provision an Elastic IP Elastic IPs are provisioned just like any other AWS service. You can find them in the EC2 Management Console, under ...
Click on the checkbox for the new IP address. Click on Actions >> Associate Elastic IP address. On the next page, search for your EC2 instance that you want to assign the IP address too. Select the IP address and click Associate. Go to EC2 >> Instances and click on the refresh Icon and the IP address should reflect your newly associated IP address.
The keyword here is static. So essentially an elastic IP address is a fixed IP address for your EC2 instances. It is associated with your AWS account and can be assigned to any EC2 instance in the ...
To request a new static EC2 address, follow these steps : Login to Cloudmin, and go to Amazon EC2 -> EC2 Static IP Addresses. Select an EC2 account from the menu at the bottom of the page (if you have more than one), and click the Allocate New Address button. If all goes well, the new IP will show up in the list on the same page.
An Elastic IP address in EC2 is a static IPv4 address that can be reassigned to different AWS resources for flexible IP management. Before you can assign an Elastic IP address, you have to allocate it in the AWS Console or with the AWS CLI. In the AWS Console, you can find the Elastic IP addresses on the EC2 tab under Networking and Security.
Allocate and associate an Elastic IP address with an Amazon EC2 instance#. An Elastic IP address is a static IPv4 address designed for dynamic cloud computing. An Elastic IP address is associated with your AWS account. With 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.
Create Elastic IP address. Login to your AWS management console and navigate to Compute >> EC2 and under Network and security click Elastic IPs. In this screen click Allocate Elastic IP address. Now a new IPv4 address will get allocated.
Change the system hostname. If you have a public DNS name registered for the IP address of your instance (such as webserver.mydomain.com), you can set the system hostname so your instance identifies itself as a part of that domain.This also changes the shell prompt so that it displays the first portion of this name instead of the hostname supplied by AWS (for example, ip-12-34-56-78).
Provide a static IP address, or use the CIDR notation (for example, <IP address>/16). Custom TCP Rule: TCP: 9443: Select Custom, and enter the public IP address of the machine or network from which you want to access the Web Admin console. Provide a static IP address, or use the CIDR notation (for example, <IP address>/16).