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.You must specifyAllocationId and either InstanceId, NetworkInterfaceId, or PrivateIpAddress. |
| Id | awscc.ec2.eip_associations |
Fields
- get (all properties)
- list (identifiers only)
| Name | Datatype | Description |
|---|---|---|
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. |
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. |
allocation_id | string | The allocation ID. This is required. |
id | string | |
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. |
e_ip | string | |
region | string | AWS region. |
| Name | Datatype | Description |
|---|---|---|
id | string | |
region | string | AWS region. |
For more information, see AWS::EC2::EIPAssociation.
Methods
| Name | Resource | Accessible by | Required Params |
|---|---|---|---|
create_resource | eip_associations | INSERT | region |
delete_resource | eip_associations | DELETE | Identifier, region |
list_resources | eip_associations_list_only | SELECT | region |
get_resource | eip_associations | SELECT | Identifier, region |
SELECT examples
- get (all properties)
- list (identifiers only)
Gets all properties from an individual eip_association.
SELECT
region,
private_ip_address,
instance_id,
allocation_id,
id,
network_interface_id,
e_ip
FROM awscc.ec2.eip_associations
WHERE
region = '{{ region }}' AND
Identifier = '{{ id }}';
Lists all eip_associations in a region.
SELECT
region,
id
FROM awscc.ec2.eip_associations_list_only
WHERE
region = '{{ region }}';
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 awscc.ec2.eip_associations (
PrivateIpAddress,
InstanceId,
AllocationId,
NetworkInterfaceId,
EIP,
region
)
SELECT
'{{ private_ip_address }}',
'{{ instance_id }}',
'{{ allocation_id }}',
'{{ network_interface_id }}',
'{{ e_ip }}',
'{{ region }}'
RETURNING
ErrorCode,
EventTime,
Identifier,
Operation,
OperationStatus,
RequestToken,
ResourceModel,
RetryAfter,
StatusMessage,
TypeName
;
/*+ create */
INSERT INTO awscc.ec2.eip_associations (
PrivateIpAddress,
InstanceId,
AllocationId,
NetworkInterfaceId,
EIP,
region
)
SELECT
'{{ private_ip_address }}',
'{{ instance_id }}',
'{{ allocation_id }}',
'{{ network_interface_id }}',
'{{ e_ip }}',
'{{ region }}'
RETURNING
ErrorCode,
EventTime,
Identifier,
Operation,
OperationStatus,
RequestToken,
ResourceModel,
RetryAfter,
StatusMessage,
TypeName
;
version: 1
name: stack name
description: stack description
providers:
- aws
globals:
- name: region
value: '{{ vars.AWS_REGION }}'
resources:
- name: eip_association
props:
- name: private_ip_address
value: '{{ private_ip_address }}'
- name: instance_id
value: '{{ instance_id }}'
- name: allocation_id
value: '{{ allocation_id }}'
- name: network_interface_id
value: '{{ network_interface_id }}'
- name: e_ip
value: '{{ e_ip }}'
DELETE example
/*+ delete */
DELETE FROM awscc.ec2.eip_associations
WHERE
Identifier = '{{ id }}' AND
region = '{{ region }}'
RETURNING
ErrorCode,
EventTime,
Identifier,
Operation,
OperationStatus,
RequestToken,
ResourceModel,
RetryAfter,
StatusMessage,
TypeName
;
Additional Parameters
Mutable resources in the Cloud Control provider support additional optional parameters which can be supplied with INSERT, UPDATE, or DELETE operations. These include:
| Parameter | Description |
|---|---|
ClientToken | A unique identifier to ensure the idempotency of the resource request.This allows the provider to accurately distinguish between retries and new requests.A client token is valid for 36 hours once used. After that, a resource request with the same client token is treated as a new request. If you do not specify a client token, one is generated for inclusion in the request. |
RoleArn | The ARN of the IAM role used to perform this resource operation.The role specified must have the permissions required for this operation.If you do not specify a role, a temporary session is created using your AWS user credentials. |
TypeVersionId | For private resource types, the type version to use in this resource operation.If you do not specify a resource version, the default version is used. |
Permissions
To operate on the eip_associations resource, the following permissions are required:
- Read
- Create
- List
- Delete
ec2:DescribeAddresses
ec2:DescribeAddresses,
ec2:AssociateAddress
ec2:DescribeAddresses
ec2:DisassociateAddress,
ec2:DescribeAddresses