eip_associations
Creates, updates, deletes or gets an eip_association
resource or lists eip_associations
in a region
Overview
Name | eip_associations |
Type | Resource |
Description | Associates an Elastic IP address with an instance or a network interface. Before you can use an Elastic IP address, you must allocate it to your account. For more information about working with Elastic IP addresses, see [Elastic IP address concepts and rules](https://docs.aws.amazon.com/vpc/latest/userguide/vpc-eips.html#vpc-eip-overview). You must specify AllocationId and either InstanceId , NetworkInterfaceId , or PrivateIpAddress . |
Id | aws.ec2.eip_associations |
Fields
Name | Datatype | Description |
---|---|---|
id | string | |
allocation_id | string | The allocation ID. This is required. |
network_interface_id | string | The ID of the network interface. If the instance has more than one network interface, you must specify a network interface ID. You can specify either the instance ID or the network interface ID, but not both. |
instance_id | string | The ID of the instance. The instance must have exactly one attached network interface. You can specify either the instance ID or the network interface ID, but not both. |
private_ip_address | string | The primary or secondary private IP address to associate with the Elastic IP address. If no private IP address is specified, the Elastic IP address is associated with the primary private IP address. |
e_ip | string | |
region | string | AWS region. |
For more information, see AWS::EC2::EIPAssociation
.
Methods
Name | Accessible by | Required Params |
---|---|---|
create_resource | INSERT | region |
delete_resource | DELETE | data__Identifier, region |
list_resources | SELECT | region |
get_resource | SELECT | data__Identifier, region |
SELECT
examples
Gets all eip_associations
in a region.
SELECT
region,
id,
allocation_id,
network_interface_id,
instance_id,
private_ip_address,
e_ip
FROM aws.ec2.eip_associations
WHERE region = 'us-east-1';
Gets all properties from an individual eip_association
.
SELECT
region,
id,
allocation_id,
network_interface_id,
instance_id,
private_ip_address,
e_ip
FROM aws.ec2.eip_associations
WHERE region = 'us-east-1' AND data__Identifier = '<Id>';
INSERT
example
Use the following StackQL query and manifest file to create a new eip_association
resource, using stack-deploy
.
- Required Properties
- All Properties
- Manifest
/*+ create */
INSERT INTO aws.ec2.eip_associations (
AllocationId,
NetworkInterfaceId,
InstanceId,
PrivateIpAddress,
EIP,
region
)
SELECT
'{{ AllocationId }}',
'{{ NetworkInterfaceId }}',
'{{ InstanceId }}',
'{{ PrivateIpAddress }}',
'{{ EIP }}',
'{{ region }}';
/*+ create */
INSERT INTO aws.ec2.eip_associations (
AllocationId,
NetworkInterfaceId,
InstanceId,
PrivateIpAddress,
EIP,
region
)
SELECT
'{{ AllocationId }}',
'{{ NetworkInterfaceId }}',
'{{ InstanceId }}',
'{{ PrivateIpAddress }}',
'{{ EIP }}',
'{{ region }}';
version: 1
name: stack name
description: stack description
providers:
- aws
globals:
- name: region
value: '{{ vars.AWS_REGION }}'
resources:
- name: eip_association
props:
- name: AllocationId
value: '{{ AllocationId }}'
- name: NetworkInterfaceId
value: '{{ NetworkInterfaceId }}'
- name: InstanceId
value: '{{ InstanceId }}'
- name: PrivateIpAddress
value: '{{ PrivateIpAddress }}'
- name: EIP
value: '{{ EIP }}'
DELETE
example
/*+ delete */
DELETE FROM aws.ec2.eip_associations
WHERE data__Identifier = '<Id>'
AND region = 'us-east-1';
Permissions
To operate on the eip_associations
resource, the following permissions are required:
Create
ec2:DescribeAddresses,
ec2:AssociateAddress
Read
ec2:DescribeAddresses
Delete
ec2:DisassociateAddress,
ec2:DescribeAddresses
List
ec2:DescribeAddresses