Skip to content

fix(ec2): use regional private DNS names - #5033

Merged
pgermosen merged 2 commits into
floci-io:mainfrom
aniketshukla1:fix/ec2-private-dns-4959
Oct 5, 2026
Merged

pgermosen merged 2 commits into
floci-io:mainfrom
aniketshukla1:fix/ec2-private-dns-4959

Conversation

@aniketshukla1

@aniketshukla1 aniketshukla1 commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Closes #4959.

  • Centralize the EC2 private DNS domain rule: us-east-1 uses ec2.internal and other regions use the regional compute.internal domain.
  • Apply it to instance, primary and secondary network-interface, container-backed instance, ECS metadata and EKS node names.
  • Resolve regional EC2 IP hostnames in the embedded DNS server while rejecting invalid region IDs.
  • Add EC2 Query protocol integration and focused unit coverage.

Type of change

  • Bug fix (fix:)
  • New feature (feat:)
  • Breaking change (feat!: or fix!:)
  • Docs / chore

AWS Compatibility

Previously RunInstances and CreateNetworkInterface returned the us-east-1 private DNS suffix in every region. The integration test validates both us-east-1 and us-west-2 through the existing EC2 Query protocol. No live AWS comparison was run.

Checklist

  • ./mvnw test passes locally
  • New or updated integration test added
  • Commit messages follow Conventional Commits
  • I have no more than 2 open, non-draft pull requests in this repository (maintainers and dependency bots are exempt).

@hectorvent hectorvent added bug Something isn't working ec2 Amazon Elastic Compute Cloud (EC2) ecs Amazon Elastic Container Service (ECS) eks Amazon Elastic Kubernetes Service (EKS) labels Oct 4, 2026
@aniketshukla1
aniketshukla1 marked this pull request as ready for review October 5, 2026 14:52
@greptile-apps

greptile-apps Bot commented Oct 5, 2026 •

Copy link
Copy Markdown

RetriggerConfidence Score: 4/5

[Medium risk] EC2 private DNS names now include the request region.

The PR’s DNS behavior appears sound, but the repository’s SDK-validation requirement should be satisfied before merging.

Findings

  1. P2 SDK validation is missing ▶
Summary

The PR centralizes regional EC2 private DNS naming across instances, network interfaces, ECS, and EKS, and extends embedded DNS resolution to regional names.

  • The previous region-catalog restriction and inline class qualification have been addressed.
  • The new management-API integration coverage uses handcrafted requests rather than SDK validation.

Reviews (2) · Last reviewed commit: "fix(ec2): resolve private DNS for patter..."

@pgermosen pgermosen left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@aniketshukla1 Thanks, pulling the domain rule into one helper is a nice cleanup.

Greptile's DNS point holds up, though. Floci accepts requests for any region that fits a partition's naming pattern, not just the published ones, so EC2 can hand out a name like ip-10-0-0-5.us-new-1.compute.internal that the new isRegionId check then refuses to resolve. Using the same check the request gate uses, RegionResolver.isKnownRegion, would keep the two in step.

Two small things while you're in there: the inline org.hamcrest.Matchers.equalTo in the integration test wants an import, and removing the search-domain constant in EcsTaskMetadataController left its doc comment behind on its own.

@pgermosen pgermosen added the waiting-author Review posted; waiting on the PR author to respond label Oct 5, 2026
Comment on lines +25 to +32
ExtractableResponse<Response> instanceResponse = given().formParam("Action", "RunInstances")
.formParam("ImageId", "ami-0abcdef1234567890")
.formParam("InstanceType", "t3.micro")
.formParam("MinCount", "1")
.formParam("MaxCount", "1")
.formParam("SubnetId", subnetId)
.header("Authorization", auth)
.when().post("/").then().statusCode(200).extract();

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 SDK validation is missing

This new test checks DescribeSubnets, RunInstances, DescribeInstances, and CreateNetworkInterface only with handcrafted Query requests. The repository guide calls for SDK-based validation where possible, particularly for management APIs. Please satisfy that requirement before merging so the test also checks that an EC2 SDK client can consume the regional private DNS names.

Context Used: AGENTS.md (source)

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

@pgermosen pgermosen left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@aniketshukla1 Thanks, all three look right, and the us-new-1 test pins the DNS part. No need for the SDK test Greptile asked for: this changes a value, not the wire shape. I dropped the draft note and put the checklist back to the template in the description, since it becomes the squash commit.

@pgermosen pgermosen removed the waiting-author Review posted; waiting on the PR author to respond label Oct 5, 2026
@pgermosen
pgermosen merged commit 4fb52e0 into floci-io:main Oct 5, 2026
27 checks passed
pgermosen pushed a commit that referenced this pull request Oct 6, 2026
… and the master (#5169)

* fix(emr): use the cluster's regional private DNS domain for instances and the master

ListInstances built every synthetic instance's PrivateDnsName as
ip-10-0-0-N.ec2.internal, the us-east-1 domain, in every region, while
RunJobFlow set MasterPublicDnsName to <region>.compute.internal, which is
wrong in us-east-1. Both now use the shared EC2 helper, so names end in
ec2.internal in us-east-1 and <region>.compute.internal elsewhere, as EC2
itself does since #5033.

* fix(emr): report the regional master DNS name for a cluster stored before the fix

DescribeCluster returned the stored MasterPublicDnsName, so a us-east-1
cluster persisted before the previous commit kept reporting
<region>.compute.internal after an upgrade. The name is now derived from the
cluster's region when the response is built.
omatheusmesmo pushed a commit to omatheusmesmo/floci that referenced this pull request Oct 12, 2026
* fix(ec2): use regional private DNS names

* fix(ec2): resolve private DNS for pattern regions
Signed-off-by: Matheus Oliveira <matheus.6148@gmail.com>
omatheusmesmo pushed a commit to omatheusmesmo/floci that referenced this pull request Oct 12, 2026
* fix(ec2): use regional private DNS names

* fix(ec2): resolve private DNS for pattern regions
Signed-off-by: Matheus Oliveira <matheus.6148@gmail.com>
omatheusmesmo pushed a commit to omatheusmesmo/floci that referenced this pull request Oct 12, 2026
… and the master (floci-io#5169)

* fix(emr): use the cluster's regional private DNS domain for instances and the master

ListInstances built every synthetic instance's PrivateDnsName as
ip-10-0-0-N.ec2.internal, the us-east-1 domain, in every region, while
RunJobFlow set MasterPublicDnsName to <region>.compute.internal, which is
wrong in us-east-1. Both now use the shared EC2 helper, so names end in
ec2.internal in us-east-1 and <region>.compute.internal elsewhere, as EC2
itself does since floci-io#5033.

* fix(emr): report the regional master DNS name for a cluster stored before the fix

DescribeCluster returned the stored MasterPublicDnsName, so a us-east-1
cluster persisted before the previous commit kept reporting
<region>.compute.internal after an upgrade. The name is now derived from the
cluster's region when the response is built.
Signed-off-by: Matheus Oliveira <matheus.6148@gmail.com>
omatheusmesmo pushed a commit to omatheusmesmo/floci that referenced this pull request Oct 12, 2026
… and the master (floci-io#5169)

* fix(emr): use the cluster's regional private DNS domain for instances and the master

ListInstances built every synthetic instance's PrivateDnsName as
ip-10-0-0-N.ec2.internal, the us-east-1 domain, in every region, while
RunJobFlow set MasterPublicDnsName to <region>.compute.internal, which is
wrong in us-east-1. Both now use the shared EC2 helper, so names end in
ec2.internal in us-east-1 and <region>.compute.internal elsewhere, as EC2
itself does since floci-io#5033.

* fix(emr): report the regional master DNS name for a cluster stored before the fix

DescribeCluster returned the stored MasterPublicDnsName, so a us-east-1
cluster persisted before the previous commit kept reporting
<region>.compute.internal after an upgrade. The name is now derived from the
cluster's region when the response is built.
Signed-off-by: Matheus Oliveira <matheus.6148@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working ec2 Amazon Elastic Compute Cloud (EC2) ecs Amazon Elastic Container Service (ECS) eks Amazon Elastic Kubernetes Service (EKS)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] EC2 PrivateDnsName uses the us-east-1 ec2.internal domain in every region

3 participants