IpAssignment
Source:
src/Fly/IpAssignment.ts
A Fly.IpAssignment is an address on an App. A Service
publishes ports. Fly’s proxy load-balances {app}.fly.dev across
Machines that publish a proxy service.
Identity is the allocated ip. There is no in-place update.
Shared IPv4
Section titled “Shared IPv4”shared_v4 is a shared Anycast IPv4. It is free. This is what you
want for fly.dev over IPv4. Yield it next to the Service.
export const PublicIp = Fly.IpAssignment("Shared", { app: Site, type: "shared_v4",});Dedicated IPv6
Section titled “Dedicated IPv6”v6 is a dedicated IPv6. It is free.
export const V6 = Fly.IpAssignment("V6", { app: Site, type: "v6",});Dedicated IPv4
Section titled “Dedicated IPv4”v4 is a billed dedicated IPv4. It may 400 if the org has no
quota. Prefer shared_v4 or v6 in tests.
export const Dedicated = Fly.IpAssignment("Dedicated", { app: Site, type: "v4",});Region
Section titled “Region”region pins a dedicated address. Shared Anycast ignores it. See
Regions for the list of codes.
export const Dedicated = Fly.IpAssignment("Dedicated", { app: Site, type: "v4", region: "iad",});Service name
Section titled “Service name”serviceName binds the address to a Fly proxy service. Changing it
replaces the assignment.
export const PublicIp = Fly.IpAssignment("Shared", { app: Site, type: "shared_v4", serviceName: "http",});Isolated network
Section titled “Isolated network”network is an optional 6PN name. Create-only.
export const Private = Fly.IpAssignment("Private", { app: Site, type: "v6", network: "private",});Organization
Section titled “Organization”orgSlug defaults to the current token’s org. It is not a
replacement key.
export const PublicIp = Fly.IpAssignment("Shared", { app: Site, type: "shared_v4", orgSlug: "my-org",});Yield with a Service
Section titled “Yield with a Service”Allocate the address on the same App as the Service. api.url is
https://{appName}.fly.dev.
export default Alchemy.Stack( "MyApp", { providers: Fly.providers(), state: Alchemy.localState() }, Effect.gen(function* () { const api = yield* Api; const ip = yield* PublicIp; return { url: api.url, ip: ip.ip }; }),);