Host
The Host resource allows you to manage AWS EC2 Hosts for your compute resources, providing options for instance family, auto placement, and recovery settings.
Minimal Example
Section titled “Minimal Example”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"});
Advanced Configuration
Section titled “Advanced Configuration”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"});
Specific Use Case: Outpost Configuration
Section titled “Specific Use Case: Outpost Configuration”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"});
Adopting Existing Resource
Section titled “Adopting Existing Resource”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});