Question: How do I troubleshoot issues with my Elastic IP address on my EC2 instances?

I'm receiving errors when allocating or releasing an Elastic IP address associated with my Amazon Elastic Compute Cloud (Amazon EC2) instance. Or, I need to restore an Elastic IP address I accidentally deleted. How can I troubleshoot common issues with my Elastic IP address?Short descriptionThe following are common issues that might occur with an Elastic IP address in your AWS account:I want to restore an accidentally deleted Elastic IP address.An associated Elastic IP address isn't released, even after terminating the EC2 instance.I'm being charged for an Elastic IP address even though it isn't associated with any of my resources.When allocating a new Elastic IP address, I'm getting the error: "Elastic IP address could not be allocated. The maximum number of addresses has been reached."When associating an Elastic IP address to one of my EC2 instances, I'm getting the error: "Elastic IP address could not be associated. You are not authorized to perform this operation."When releasing an Elastic IP address from my account, I'm getting the error: "Elastic IP address could not be released. You do not have permission to access the specified resource."ResolutionI want to restore an accidently deleted Elastic IP addressIf you released your Elastic IP address, you might be able to recover it. For more information, see Recover an Elastic IP address.An associated Elastic IP address isn't released, even after terminating the EC2 instanceTo release an Elastic IP address, you must first disassociate it from any resources. For more information, see Disassociate an Elastic IP address.After you disassociate the Elastic IP address, you can re-associate it with a different resource. You incur charges for any Elastic IP address that's allocated for use with a VPC but not associated with an instance. If you don't need the Elastic IP address, you can release it. For more information, see Release an Elastic IP address.I'm being charged for an Elastic IP address even when it is not associated to any of my resources.If you receive bills for your Elastic IP address that aren't associated with a resource, see Why am I being billed for Elastic IP addresses when all my Amazon EC2 instances are terminated?When allocating a new Elastic IP address, I'm receiving the error "Elastic IP address could not be allocated. The maximum number of addresses has been reached"All AWS accounts are limited to five Elastic IP addresses per Region. If you receive the error The maximum number of addresses has been reached, verify how many Elastic IP address you're using and what the limit is for your account.If you need additional Elastic IP addresses, request a quota increase. When creating the quota increase request, search for EC2-VPC Elastic IPs on the AWS Services tab.When associating an Elastic IP address to one of my EC2 instances, I'm getting the error: "Elastic IP address could not be associated. You are not authorized to perform this operation"The AllocateAddress API call is used to allocate an Elastic IP address to your AWS account. The AssociateAddress API call is used to associate an Elastic IP address to any of your resources.Make sure that the AWS Identity and Access Management (IAM) user or role using the command has the following required permission in the attached IAM policy:{    "Version": "2012-10-17",    "Statement": [        {            "Effect": "Allow",            "Action": [                "ec2:AllocateAddress",                "ec2:AssociateAddress"            ],            "Resource": "*"        }    ]}When releasing an Elastic IP address from my account, I'm getting the error: "Elastic IP address could not be released. You do not have permission to access the specified resource."This error message occurs when you try to release or disassociate an Elastic IP address that's used by an AWS Managed Service. Examples of AWS Managed Services are Elastic Load Balancing (ELB), NAT Gateway, Amazon Elastic File System (Amazon EFS), and so on. To release an Elastic IP address associated with an AWS Managed Service, delete the resource that's using it. For example, if you have a NAT Gateway with an attached Elastic IP address, then you must first delete the NAT Gateway before you can release the Elastic IP address.

Related informationElastic IP addresses