Skip to main content

Lab 005: Allocate Elastic IP


Requirements

The Nautilus DevOps team is strategizing the migration of a portion of their infrastructure to the AWS cloud. Recognizing the scale of this undertaking, they have opted to approach the migration in incremental steps rather than as a single massive transition. To achieve this, they have segmented large tasks into smaller, more manageable units. This granular approach enables the team to execute the migration in gradual phases, ensuring smoother implementation and minimizing disruption to ongoing operations. By breaking down the migration into smaller tasks, the Nautilus DevOps team can systematically progress through each stage, allowing for better control, risk mitigation, and optimization of resources throughout the migration process.

For this task, allocate an Elastic IP address, name it as datacenter-eip.


Note

This page preserves the original requirement text and documents one direct AWS CLI path to allocate and tag the Elastic IP.

Prerequisites

  • AWS CLI is installed and authenticated on the aws-client host.
  • You can retrieve credentials with showcreds if needed.
  • Your identity has permissions for ec2:AllocateAddress, ec2:CreateTags, and ec2:DescribeAddresses.

Steps

For the AWS credentials, enter showcreds command on aws-client host to retrieve the credentials. For further details, check out the Project Nautilus documentation.

To Elastic IP with name datacenter-eip using the AWS CLI, you can follow these steps:

# Allocate Elastic IP and get the Allocation ID
ALLOCATION_ID=$(aws ec2 allocate-address --domain vpc --query 'AllocationId' --output text)

# Tag the Elastic IP with a name
aws ec2 create-tags --resources $ALLOCATION_ID --tags Key=Name,Value=datacenter-eip

echo "Elastic IP allocated and named as datacenter-eip."

Verification

  • Confirm the Elastic IP exists in the account and region.
  • Confirm the Name tag is set to datacenter-eip.
aws ec2 describe-addresses \
--query "Addresses[?Tags[?Key=='Name'&&Value=='datacenter-eip']].{AllocationId:AllocationId,PublicIp:PublicIp,Name:Tags[?Key=='Name']|[0].Value}" \
--output table

Resources

AWS CLI Command Reference