OiO.lk Community platform!

Oio.lk is an excellent forum for developers, providing a wide range of resources, discussions, and support for those in the developer community. Join oio.lk today to connect with like-minded professionals, share insights, and stay updated on the latest trends and technologies in the development field.
  You need to log in or register to access the solved answers to this problem.
  • You have reached the maximum number of guest views allowed
  • Please register below to remove this limitation

How to fetch AWS Elastic IP quota(limit) and find out how many IP elastic addresses my terraform script can create

  • Thread starter Thread starter Mithilesh Indurkar
  • Start date Start date
M

Mithilesh Indurkar

Guest
I am fairly new to AWS CLI. I am trying to find out the limit(quota) of elastic IP addresses for a region(e.g. us-east-1). From that limit, how many have been used and how many are remaining for my terraform script to use. I need to use this to conditionalise the further flow. Need help. Right now I have tried to use the below but it gives me wrong answer.

Code:
Available_Elastic_IPs=$(AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_KEY AWS_SESSION_TOKEN=$AWS_SESSION_TOKEN aws ec2 describe-addresses --query "Addresses[?NetworkInterfaceId == null ].PublicIp" --region "$REGION" --output "text" | wc -w)

This tells me where the network interface ID are null. Even if the count is 0, I can still go ahead and create EC2 instances with elastic IPs. So I think the query needs slight adjustment.
<p>I am fairly new to AWS CLI. I am trying to find out the limit(quota) of elastic IP addresses for a region(e.g. us-east-1). From that limit, how many have been used and how many are remaining for my terraform script to use. I need to use this to conditionalise the further flow. Need help. Right now I have tried to use the below but it gives me wrong answer.</p>
<pre><code>Available_Elastic_IPs=$(AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_KEY AWS_SESSION_TOKEN=$AWS_SESSION_TOKEN aws ec2 describe-addresses --query "Addresses[?NetworkInterfaceId == null ].PublicIp" --region "$REGION" --output "text" | wc -w)
</code></pre>
<p>This tells me where the network interface ID are null. Even if the count is 0, I can still go ahead and create EC2 instances with elastic IPs. So I think the query needs slight adjustment.</p>
Continue reading...
 

Latest posts

D
Replies
0
Views
1
Danish Karmally
D
Top