I need some help here.
I'm trying to obtain a public IP from a network interface using boto3, for some reason I'm getting the following error:
ec2 = boto3.resource('ec2')
nia = ec2.NetworkInterfaceAssociation('eni-r2d2')
nia.id # I can obtain the id without any issue
# 'eni-r2d2'
nia.public_ip
# /usr/local/lib/python3.6/site-packages/boto3/resources/factory.py in property_loader(self)
# 343 self.__class__.__name__))
# 344
# --> 345 return self.meta.data.get(name)
# 346
# 347 property_loader.__name__ = str(snake_cased)
#
# AttributeError: 'NoneType' object has no attribute 'get'
Note: The network interface belongs to an ECS task, launch type is FARGATE and the network mode is awsvpc. Can someone help me please?
Thanks!