eips
Creates, updates, deletes or gets an eip resource or lists eips in a region
Overview
| Name | eips |
| Type | Resource |
| Description | Specifies an Elastic IP (EIP) address and can, optionally, associate it with an Amazon EC2 instance.You can allocate an Elastic IP address from an address pool owned by AWS or from an address pool created from a public IPv4 address range that you have brought to AWS for use with your AWS resources using bring your own IP addresses (BYOIP). For more information, see Bring Your Own IP Addresses (BYOIP) in the Amazon EC2 User Guide.For more information, see Elastic IP Addresses in the Amazon EC2 User Guide. |
| Id | awscc.ec2.eips |
Fields
- get (all properties)
- list (identifiers only)
| Name | Datatype | Description |
|---|---|---|
public_ip | string | |
allocation_id | string | |
domain | string | The network (If you define an Elastic IP address and associate it with a VPC that is defined in the same template, you must declare a dependency on the VPC-gateway attachment by using the DependsOn Attribute on this resource. |
network_border_group | string | A unique set of Availability Zones, Local Zones, or Wavelength Zones from which AWS advertises IP addresses. Use this parameter to limit the IP address to this location. IP addresses cannot move between network border groups.Use DescribeAvailabilityZones to view the network border groups. |
transfer_address | string | The Elastic IP address you are accepting for transfer. You can only accept one transferred address. For more information on Elastic IP address transfers, see Transfer Elastic IP addresses in the Amazon Virtual Private Cloud User Guide. |
instance_id | string | The ID of the instance.Updates to theInstanceId property may require some interruptions. Updates on an EIP reassociates the address on its associated resource. |
public_ipv4_pool | string | The ID of an address pool that you own. Use this parameter to let Amazon EC2 select an address from the address pool.Updates to thePublicIpv4Pool property may require some interruptions. Updates on an EIP reassociates the address on its associated resource. |
ipam_pool_id | string | |
address | string | |
tags | array | Any tags assigned to the Elastic IP address.Updates to theTags property may require some interruptions. Updates on an EIP reassociates the address on its associated resource. |
region | string | AWS region. |
| Name | Datatype | Description |
|---|---|---|
public_ip | string | |
allocation_id | string | |
region | string | AWS region. |
For more information, see AWS::EC2::EIP.
Methods
| Name | Resource | Accessible by | Required Params |
|---|---|---|---|
create_resource | eips | INSERT | region |
delete_resource | eips | DELETE | Identifier, region |
update_resource | eips | UPDATE | Identifier, PatchDocument, region |
list_resources | eips_list_only | SELECT | region |
get_resource | eips | SELECT | Identifier, region |
SELECT examples
- get (all properties)
- list (identifiers only)
Gets all properties from an individual eip.
SELECT
region,
public_ip,
allocation_id,
domain,
network_border_group,
transfer_address,
instance_id,
public_ipv4_pool,
ipam_pool_id,
address,
tags
FROM awscc.ec2.eips
WHERE
region = '{{ region }}' AND
Identifier = '{{ public_ip }}|{{ allocation_id }}';
Lists all eips in a region.
SELECT
region,
public_ip,
allocation_id
FROM awscc.ec2.eips_list_only
WHERE
region = '{{ region }}';
INSERT example
Use the following StackQL query and manifest file to create a new eip resource, using stack-deploy.
- Required Properties
- All Properties
- Manifest
/*+ create */
INSERT INTO awscc.ec2.eips (
Domain,
NetworkBorderGroup,
TransferAddress,
InstanceId,
PublicIpv4Pool,
IpamPoolId,
Address,
Tags,
region
)
SELECT
'{{ domain }}',
'{{ network_border_group }}',
'{{ transfer_address }}',
'{{ instance_id }}',
'{{ public_ipv4_pool }}',
'{{ ipam_pool_id }}',
'{{ address }}',
'{{ tags }}',
'{{ region }}'
RETURNING
ErrorCode,
EventTime,
Identifier,
Operation,
OperationStatus,
RequestToken,
ResourceModel,
RetryAfter,
StatusMessage,
TypeName
;
/*+ create */
INSERT INTO awscc.ec2.eips (
Domain,
NetworkBorderGroup,
TransferAddress,
InstanceId,
PublicIpv4Pool,
IpamPoolId,
Address,
Tags,
region
)
SELECT
'{{ domain }}',
'{{ network_border_group }}',
'{{ transfer_address }}',
'{{ instance_id }}',
'{{ public_ipv4_pool }}',
'{{ ipam_pool_id }}',
'{{ address }}',
'{{ tags }}',
'{{ 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
props:
- name: domain
value: '{{ domain }}'
- name: network_border_group
value: '{{ network_border_group }}'
- name: transfer_address
value: '{{ transfer_address }}'
- name: instance_id
value: '{{ instance_id }}'
- name: public_ipv4_pool
value: '{{ public_ipv4_pool }}'
- name: ipam_pool_id
value: '{{ ipam_pool_id }}'
- name: address
value: '{{ address }}'
- name: tags
value:
- key: '{{ key }}'
value: '{{ value }}'
UPDATE example
Use the following StackQL query and manifest file to update a eip resource, using stack-deploy.
/*+ update */
UPDATE awscc.ec2.eips
SET PatchDocument = string('{{ {
"Domain": domain,
"InstanceId": instance_id,
"PublicIpv4Pool": public_ipv4_pool,
"Tags": tags
} | generate_patch_document }}')
WHERE
region = '{{ region }}' AND
Identifier = '{{ public_ip }}|{{ allocation_id }}'
RETURNING
ErrorCode,
EventTime,
Identifier,
Operation,
OperationStatus,
RequestToken,
ResourceModel,
RetryAfter,
StatusMessage,
TypeName
;
DELETE example
/*+ delete */
DELETE FROM awscc.ec2.eips
WHERE
Identifier = '{{ public_ip }}|{{ allocation_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 eips resource, the following permissions are required:
- Create
- Read
- Delete
- Update
- List
ec2:AllocateAddress,
ec2:AcceptAddressTransfer,
ec2:DescribeAddresses,
ec2:AssociateAddress,
ec2:CreateTags
ec2:DescribeAddresses
ec2:ReleaseAddress,
ec2:DescribeAddresses,
ec2:DisassociateAddress
ec2:DescribeAddresses,
ec2:DisassociateAddress,
ec2:DeleteTags,
ec2:CreateTags,
ec2:AssociateAddress
ec2:DescribeAddresses