elastic-ip

boto3 how to retrieve the elastic ip from an instance

醉酒当歌 提交于 2021-01-28 16:47:52
问题 I need to do the following: I have some instances that contain a certain tag, I need to loop through those instances and for each instance which contains that certain tag, if that instance has an elastic ip attached, I need to tag that elastic ip with that same tag. My code is the following: import boto3 import json region_list = ['us-east-1'] session = boto3.Session(profile_name='default') for region in region_list: ec2 = session.resource('ec2',region) client = boto3.client('ec2',region) #

boto3 how to retrieve the elastic ip from an instance

北战南征 提交于 2021-01-28 16:33:21
问题 I need to do the following: I have some instances that contain a certain tag, I need to loop through those instances and for each instance which contains that certain tag, if that instance has an elastic ip attached, I need to tag that elastic ip with that same tag. My code is the following: import boto3 import json region_list = ['us-east-1'] session = boto3.Session(profile_name='default') for region in region_list: ec2 = session.resource('ec2',region) client = boto3.client('ec2',region) #

Need to release all those elastic IP that are unassociated using boto3 in All regions

爷,独闯天下 提交于 2020-12-13 05:45:23
问题 I am using boto3 along with lamda to release the unused elastic IPs. Here I need to release all those IPs present in all regions of My AWS account. def elastic_ips_cleanup(): client = boto3.client('ec2') addresses_dict = client.describe_addresses() for eip_dict in addresses_dict['Addresses']: if "InstanceId" not in eip_dict: print (eip_dict['PublicIp'] + " doesn't have any instances associated, releasing") client.release_address(AllocationId=eip_dict['AllocationId']) I used the above codes

Use one AWS Elastic IP for several instances

◇◆丶佛笑我妖孽 提交于 2020-02-23 06:45:08
问题 I need to provide my customers with fixed urls that don't change when the EC2 instances are stopped/started because sometimes we need to change the size of the EC2 and when we restart the instance the public IP has changed. I thought on using Elastic IPs so I can keep the same public IP when the instance is rebooted, but I've seen that Amazon tells you that you only have 5 Elastic IPs. If you ask them they say that they can give you more, but I guess they're not giving you 10.000 of them. How

How to choose Elastic IP when my aws lambda function execute

拈花ヽ惹草 提交于 2019-12-24 10:46:26
问题 I want to select specific Elastic IP my own when my lambda function executed. my service has to respond to several situations, and by user's attributes. Could I write code in a lambda function, that can choose specific my own elastic IP? I had searched for this. but old information says it cannot do. but recently I heard about it is possible by using Network Load Balancer or Application Load Balancer. But I don't know how to use this for the problem. 回答1: No. You cannot associate an Elastic

AWS Elastic IP Network vpc is not attached to any internet gateway

独自空忆成欢 提交于 2019-12-21 03:30:38
问题 I have given a limited access to a AWS account. I already created an EC2 instance but when I try to associate an elastic ip, I got the error below: An error occurred while attempting to associate the address Network vpc-(security id) is not attached to any internet gateway 回答1: You are using the new Amazon Virtual Private Cloud instead of the EC2 Classic. The cloud you are using lacks the internet gateway virtual component that is necessary for the cloud to be reachable from the public

CloudFormation ElasticIP Parameter

杀马特。学长 韩版系。学妹 提交于 2019-12-12 07:01:19
问题 I have a CloudFormation template which adds OpenVPN to an existing VPC and requires an Elastic IP allocation ID as a parameter. It also adds the public IP address from the same Elastic IP to the OpenVPN instance configuration (in it's UserData section). I've currently implemented this as 2 parameters (using made-up defaults) i.e. Parameters: ElasticIpAddress: Description: >- IP Address of an Elastic IP. Type: String Default: 53.176.52.215 ElasticIpAllocationId: Description: >- Allocation id

Assigning static IPs to auto scaled EC2 instance

半城伤御伤魂 提交于 2019-12-11 02:15:35
问题 We have a 3rd party integration which needs the EC2 instance IP to be whitelisted. The 3rd party whitelists the IP on their server and then only the EC2 instance can communicate with them. In the case of single instance this works. However when auto scaling kicks in, we would end up in more than 1 instance. These new instances automatically get new IPs for every autoscale action. Is it possible for us to ask AWS to assign IPs from a say a set of 4 predefined Elastic IPs? ( Assumption is that

How can I select all elastic IPs that are not assigned to an EC2 instance?

ε祈祈猫儿з 提交于 2019-12-09 16:23:44
问题 I'm trying to get all Elastic IPs that are not currently assigned to instances. It's easy to get all of the Elastic IPs using this: aws ec2 describe-addresses From here, it would be easy to filter out any results that do not have an "AssociationId" . However, I'm not sure how to do that using --query . I know that the --query option uses JMESPath to filter results, but I have no idea how to tell it to return me all results that do not have an AssociationId . Any help? Thanks. 回答1: You can

How can I select all elastic IPs that are not assigned to an EC2 instance?

ⅰ亾dé卋堺 提交于 2019-12-04 03:17:34
I'm trying to get all Elastic IPs that are not currently assigned to instances. It's easy to get all of the Elastic IPs using this: aws ec2 describe-addresses From here, it would be easy to filter out any results that do not have an "AssociationId" . However, I'm not sure how to do that using --query . I know that the --query option uses JMESPath to filter results, but I have no idea how to tell it to return me all results that do not have an AssociationId . Any help? Thanks. You can check the Addresses collection for null values, but instead of AssociationId a better general solution may be