Skip to content
GitHubXDiscordRSS

Host

Learn how to create, update, and manage AWS EC2 Hosts using Alchemy Cloud Control.

The Host resource allows you to manage AWS EC2 Hosts for your compute resources, providing options for instance family, auto placement, and recovery settings.

Create a basic EC2 Host with required properties and one optional property for instance family.

import AWS from "alchemy/aws/control";
const ec2Host = await AWS.EC2.Host("myEc2Host", {
AvailabilityZone: "us-west-2a",
InstanceFamily: "m5"
});

Configure an EC2 Host with auto placement and host recovery options.

const advancedEc2Host = await AWS.EC2.Host("advancedEc2Host", {
AvailabilityZone: "us-east-1b",
InstanceFamily: "c5",
AutoPlacement: "on",
HostRecovery: "on"
});

Create an EC2 Host that is associated with an Outpost to extend your on-premises infrastructure.

const outpostEc2Host = await AWS.EC2.Host("outpostEc2Host", {
AvailabilityZone: "us-west-1a",
InstanceFamily: "r5",
OutpostArn: "arn:aws:outposts:us-west-1:123456789012:outpost/op-abcdefg123456789",
HostMaintenance: "on"
});

If you want to adopt an existing EC2 Host instead of failing if it already exists, set the adopt property to true.

const adoptEc2Host = await AWS.EC2.Host("adoptEc2Host", {
AvailabilityZone: "eu-central-1a",
InstanceFamily: "t3",
adopt: true
});