Bird
Raised Fist0
AWScloud~10 mins

Elastic IP addresses in AWS - Step-by-Step Execution

Choose your learning style10 modes available

Start learning this pattern below

Jump into concepts and practice - no test required

or
Recommended
Test this pattern10 questions across easy, medium, and hard to know if this pattern is strong
Process Flow - Elastic IP addresses
Request Elastic IP
AWS allocates Elastic IP
Associate Elastic IP with EC2 Instance
Instance uses Elastic IP for communication
Disassociate or Release Elastic IP
Elastic IP becomes free or reassigned
This flow shows how you request, allocate, associate, and release an Elastic IP address in AWS.
Execution Sample
AWS
1. Allocate Elastic IP
2. Associate Elastic IP with EC2 instance
3. Use Elastic IP for external access
4. Disassociate Elastic IP
5. Release Elastic IP
This sequence shows the lifecycle of an Elastic IP address from allocation to release.
Process Table
StepActionAWS State ChangeElastic IP StatusInstance IP Status
1Allocate Elastic IPElastic IP allocated and reservedAllocated, not associatedInstance has private IP only
2Associate Elastic IP with EC2 instanceElastic IP linked to instanceAssociatedInstance now reachable via Elastic IP
3Instance uses Elastic IPTraffic routed through Elastic IPAssociatedInstance accessible publicly
4Disassociate Elastic IPElastic IP unlinked from instanceAllocated, not associatedInstance loses public IP
5Release Elastic IPElastic IP returned to AWS poolReleasedInstance has private IP only
💡 Elastic IP released back to AWS, no longer associated with any instance.
Status Tracker
VariableStartAfter Step 1After Step 2After Step 4Final
Elastic IP StatusNoneAllocatedAssociatedAllocatedReleased
Instance Public IPNoneNoneElastic IP assignedNoneNone
Key Moments - 3 Insights
Why does the instance lose its public IP after disassociation?
Because the Elastic IP is no longer linked to the instance (see execution_table step 4), the instance reverts to only its private IP.
Can you use an Elastic IP without associating it to an instance?
No, an Elastic IP must be associated with an instance to route traffic (see execution_table step 1 vs step 2).
What happens if you release an Elastic IP without disassociating it first?
AWS automatically disassociates it before releasing, so the Elastic IP becomes free and the instance loses public IP (implied in step 5).
Visual Quiz - 3 Questions
Test your understanding
Look at the execution table, what is the Elastic IP status after step 3?
AAllocated, not associated
BAssociated
CReleased
DDisassociated
💡 Hint
Check the 'Elastic IP Status' column at step 3 in the execution_table.
At which step does the instance lose its public IP?
AStep 4
BStep 2
CStep 3
DStep 5
💡 Hint
Look at the 'Instance IP Status' column in execution_table for when it changes from 'Elastic IP assigned' to 'None'.
If you skip step 4 and directly release the Elastic IP, what happens to the instance's public IP?
AElastic IP remains associated but unusable
BInstance keeps the Elastic IP
CInstance loses the public IP automatically
DInstance gets a new Elastic IP automatically
💡 Hint
Refer to key_moments about releasing Elastic IP without disassociation.
Concept Snapshot
Elastic IP addresses are static public IPs you allocate from AWS.
You must associate them with an EC2 instance to enable public access.
Disassociating removes the public IP from the instance.
Releasing returns the IP to AWS and frees it for others.
Use Elastic IPs to keep a fixed public IP even if instance stops or restarts.
Full Transcript
Elastic IP addresses in AWS are static public IPs that you can allocate and assign to your EC2 instances. The process starts by requesting an Elastic IP, which AWS reserves for your use. Then you associate this Elastic IP with an EC2 instance, allowing it to be reachable from the internet using that fixed IP. When the instance uses the Elastic IP, all external traffic routes through it. If you disassociate the Elastic IP, the instance loses its public IP and becomes reachable only via its private IP. Finally, releasing the Elastic IP returns it to AWS's pool, making it available for others. This lifecycle ensures you can maintain a consistent public IP for your instance even if it stops or restarts.

Practice

(1/5)
1. What is the main purpose of an Elastic IP address in AWS?
easy
A. To provide a fixed public IP address that can be reassigned to different instances
B. To increase the storage capacity of an EC2 instance
C. To encrypt data in transit between AWS services
D. To automatically scale the number of EC2 instances

Solution

  1. Step 1: Understand Elastic IP purpose

    An Elastic IP is a static public IP address designed to be associated with AWS resources like EC2 instances.
  2. Step 2: Identify its main use

    It allows you to keep the same public IP even if you stop and start or replace the instance, ensuring consistent reachability.
  3. Final Answer:

    To provide a fixed public IP address that can be reassigned to different instances -> Option A
  4. Quick Check:

    Elastic IP = Fixed public IP for instances [OK]
Hint: Elastic IP means fixed public IP for your server [OK]
Common Mistakes:
  • Confusing Elastic IP with storage or encryption
  • Thinking Elastic IP auto-scales instances
  • Assuming Elastic IP changes on instance restart
2. Which AWS CLI command correctly allocates a new Elastic IP address?
easy
A. aws ec2 create-elastic-ip
B. aws ec2 assign-elastic-ip
C. aws ec2 new-ip-address
D. aws ec2 allocate-address

Solution

  1. Step 1: Recall AWS CLI syntax for Elastic IP allocation

    The correct command to allocate a new Elastic IP is 'aws ec2 allocate-address'.
  2. Step 2: Verify other options

    Other options are invalid AWS CLI commands and will cause errors.
  3. Final Answer:

    aws ec2 allocate-address -> Option D
  4. Quick Check:

    Allocate Elastic IP = aws ec2 allocate-address [OK]
Hint: Allocate Elastic IP with 'allocate-address' command [OK]
Common Mistakes:
  • Using non-existent commands like create-elastic-ip
  • Confusing allocation with assignment commands
  • Misspelling the command name
3. Consider this AWS CLI output after associating an Elastic IP to an instance:
{
  "AssociationId": "eipassoc-12345678",
  "PublicIp": "203.0.113.25",
  "InstanceId": "i-0abcd1234efgh5678"
}
What does this output indicate?
medium
A. The Elastic IP 203.0.113.25 is now linked to the instance i-0abcd1234efgh5678
B. The instance i-0abcd1234efgh5678 has been terminated
C. The Elastic IP has been released and is no longer usable
D. The instance has no public IP assigned

Solution

  1. Step 1: Analyze the output fields

    The output shows an AssociationId, a PublicIp, and an InstanceId, indicating a link between the IP and instance.
  2. Step 2: Interpret the meaning

    This means the Elastic IP 203.0.113.25 is assigned to the instance i-0abcd1234efgh5678.
  3. Final Answer:

    The Elastic IP 203.0.113.25 is now linked to the instance i-0abcd1234efgh5678 -> Option A
  4. Quick Check:

    AssociationId means IP linked to instance [OK]
Hint: AssociationId means IP linked to instance [OK]
Common Mistakes:
  • Thinking the instance is terminated
  • Assuming the IP is released
  • Ignoring the AssociationId meaning
4. You tried to associate an Elastic IP to an instance but got an error: "AddressLimitExceeded". What is the likely cause?
medium
A. The instance does not have an internet gateway attached
B. You have reached the maximum number of Elastic IPs allowed in your AWS account
C. The Elastic IP is not in the same region as the instance
D. The instance is already terminated

Solution

  1. Step 1: Understand the error message

    "AddressLimitExceeded" means you have hit the limit of Elastic IPs you can allocate in your AWS account.
  2. Step 2: Check other options

    Instance termination or region mismatch cause different errors; internet gateway absence affects connectivity but not this error.
  3. Final Answer:

    You have reached the maximum number of Elastic IPs allowed in your AWS account -> Option B
  4. Quick Check:

    AddressLimitExceeded = Max Elastic IPs reached [OK]
Hint: AddressLimitExceeded means max Elastic IPs reached [OK]
Common Mistakes:
  • Confusing region mismatch with limit error
  • Assuming instance termination causes this error
  • Thinking internet gateway absence triggers this error
5. You have an Elastic IP associated with an EC2 instance. You stop and start the instance. What happens to the Elastic IP and the instance's public IP?
hard
A. The Elastic IP remains but the instance loses its public IP until reassigned
B. The Elastic IP is released automatically and the instance gets a new public IP
C. The Elastic IP remains associated and the instance keeps the same public IP
D. The Elastic IP dissociates and you must manually re-associate it

Solution

  1. Step 1: Recall Elastic IP behavior on instance stop/start

    Elastic IPs remain allocated and associated with the instance even if it is stopped and started.
  2. Step 2: Understand public IP behavior

    Without Elastic IP, the public IP changes on stop/start, but with Elastic IP, the public IP stays the same.
  3. Final Answer:

    The Elastic IP remains associated and the instance keeps the same public IP -> Option C
  4. Quick Check:

    Elastic IP keeps public IP fixed on stop/start [OK]
Hint: Elastic IP keeps public IP fixed after stop/start [OK]
Common Mistakes:
  • Thinking Elastic IP is released on stop/start
  • Assuming public IP changes despite Elastic IP
  • Believing manual reassociation is needed