import * as iam from "@distilled.cloud/aws/iam"; import * as s3 from "@distilled.cloud/aws/s3"; import * as Effect from "effect/Effect"; import * as FileSystem from "effect/FileSystem"; import type * as rolldown from "rolldown"; import * as Bundle from "../../Bundle/Bundle.ts"; import type { ScopedPlanStatusSession } from "../../Cli/Cli.ts"; import type { Input } from "../../Input.ts"; import type { PlatformProps } from "../../Platform.ts"; import type { ResourceBinding } from "../../Resource.ts"; import { createHostRuntimeContext, type HostRuntimeContext } from "../../Server/Process.ts"; import { Assets } from "../Assets.ts"; import type { PolicyStatement } from "../IAM/Policy.ts"; /** * Binding contract accepted by EC2-hosted runtimes: environment variables and * IAM policy statements attached by capability bindings. */ export interface Ec2HostedBinding { /** Environment variables injected into the hosted runtime. */ env?: Record; /** IAM policy statements attached to the instance profile role. */ policyStatements?: PolicyStatement[]; } /** * Shared props for EC2-backed hosted runtimes (an Instance that bundles and * runs an application entrypoint). */ export interface Ec2HostedProps extends PlatformProps { /** AMI ID to launch the instance from. */ imageId: string; /** EC2 instance type, e.g. `t3.micro`. */ instanceType: string; /** Name of an EC2 key pair for SSH access. */ keyName?: Input; /** Existing instance profile to attach instead of a managed one. */ instanceProfileName?: string; /** Additional user-data script prepended to the runtime bootstrap. */ userData?: string; /** Subnet to launch the instance into. */ subnetId?: any; /** Security groups attached to the instance. */ securityGroupIds?: readonly any[]; /** Whether to associate a public IP address. */ associatePublicIpAddress?: boolean; /** Static private IP address within the subnet. */ privateIpAddress?: string; /** Availability Zone to launch into. */ availabilityZone?: string; /** Tags applied to the instance. */ tags?: Record; /** Path to the application entrypoint to bundle and run on the instance. */ main?: string; /** Named export of the handler within `main`. */ handler?: string; /** Port the hosted HTTP server listens on. */ port?: number; /** Environment variables injected into the hosted runtime. */ env?: Record; /** * Overrides for the rolldown bundling of `main`: `input`/`output` * overrides plus pure-annotation options (`pure`). `effect`, `@effect/*`, * `alchemy`, `@alchemy.run/*`, and `@distilled.cloud/*` are annotated as * pure by default so unused code from those packages is tree-shaken; list * additional packages via `pure.packages`, or disable with `pure: false`. */ build?: Bundle.BundleConfig; /** Managed policy ARNs attached to the instance role. */ roleManagedPolicyArns?: string[]; } export interface Ec2HostedRuntimeState { userData?: string; roleName?: string; roleArn?: string; policyName?: string; instanceProfileName?: string; instanceProfileArn?: string; managedIam?: boolean; runtimeUnitName?: string; assetPrefix?: string; code?: { hash: string; }; } export interface Ec2HostedCleanupState { roleName?: string; policyName?: string; instanceProfileName?: string; managedIam?: boolean; assetPrefix?: string; } /** * Deploy-time / plan-time host context for EC2-backed platforms that bundle a * long-lived program (`exports.program`) and collect background work via `run` * / HTTP handlers via `serve`. Alias of the shared {@link HostRuntimeContext}. */ export type Ec2HostRuntimeContext = HostRuntimeContext; export declare const createEc2HostRuntimeContext: typeof createHostRuntimeContext; export declare const createEc2HostedSupport: ({ stackName, stage, virtualEntryPlugin, resourceType, }: { stackName: string; stage: string; fs: FileSystem.FileSystem; virtualEntryPlugin: (content: (importPath: string) => string) => rolldown.Plugin; resourceType: string; }) => { normalizeSecurityGroups: (groups?: readonly string[]) => string[]; buildLaunchTemplateData: (news: Pick, runtime: Pick) => { ImageId: string; InstanceType: string; KeyName: string | undefined; IamInstanceProfile: { Name: string; } | undefined; UserData: any; Placement: { AvailabilityZone: string; } | undefined; NetworkInterfaces: { DeviceIndex: number; SubnetId: any; Groups: string[] | undefined; AssociatePublicIpAddress: boolean | undefined; PrivateIpAddress: string | undefined; DeleteOnTermination: boolean; }[] | undefined; SubnetId: any; SecurityGroupIds: string[] | undefined; PrivateIpAddress: string | undefined; TagSpecifications: { ResourceType: string; Tags: { Key: string; Value: string; }[]; }[] | undefined; }; bundleProgram: (id: string, props: Ec2HostedProps) => Effect.Effect<{ archive: Buffer; hash: string; }, Error | import("effect/PlatformError").PlatformError, FileSystem.FileSystem | import("effect/Path").Path>; resolveHostedRuntime: (args_0: { id: string; news: Ec2HostedProps; bindings: ResourceBinding[]; output?: Ec2HostedRuntimeState; }) => Effect.Effect<{ userData: string | undefined; roleName: string | undefined; roleArn: string | undefined; policyName: string | undefined; instanceProfileName: string | undefined; instanceProfileArn: string | undefined; managedIam: boolean; runtimeUnitName: string | undefined; assetPrefix: string | undefined; code: { hash: string; } | undefined; }, Error | import("effect/unstable/http/HttpClientError").HttpClientError | import("effect/PlatformError").PlatformError | { readonly _tag: "AssetsUploadError"; readonly message: string; readonly cause?: unknown; } | { readonly _tag: "AssetsCheckError"; readonly message: string; readonly cause?: unknown; }, Assets | FileSystem.FileSystem | import("../../InstanceId.ts").InstanceId | import("effect/Path").Path | import("../../Stack.ts").Stack | import("../../Stage.ts").Stage | import("../Assets.ts").AssetsRequirements>; cleanupHostedRuntime: (args_0: { output: Ec2HostedCleanupState; session?: Pick; }) => Effect.Effect; }; //# sourceMappingURL=hosted.d.ts.map