Skip to content

InstanceRegistration

Source: src/AWS/CloudMap/InstanceRegistration.ts

A manual AWS Cloud Map instance registration — registers a static endpoint (an IP, port, CNAME, or an arbitrary attribute bag) with a Cloud Map service so it is returned by DiscoverInstances and, for DNS services, resolvable via Route 53.

Use this for non-ECS targets: static IPs, on-prem hosts, external dependencies. ECS registers its own tasks automatically via serviceRegistries.

RegisterInstance is an upsert — reconcile re-registers with the desired attributes and Cloud Map converges the records. Registration and deregistration are asynchronous; the provider polls the operations API (bounded) until they complete.

Register a Static IP

import * as AWS from "alchemy/AWS";
const instance = yield* AWS.CloudMap.InstanceRegistration("Primary", {
serviceId: service.serviceId,
instanceId: "primary",
attributes: { AWS_INSTANCE_IPV4: "10.0.1.10" },
});

Register an API-only Instance with Custom Attributes

const instance = yield* AWS.CloudMap.InstanceRegistration("Worker", {
serviceId: service.serviceId,
instanceId: "worker-1",
attributes: { endpoint: "https://worker-1.internal:8443", zone: "us-west-2a" },
});