Skip to main content

EC2 Instance

Manages an EC2 instance resource, a.k.a virtual machine.

const server = await provider.makeEC2({
name: "myserver",
properties: () => ({
InstanceType: "t2.micro",
ImageId: "ami-0917237b4e71c5759", // Ubuntu 20.04
}),
dependencies: {
keyPair,
subnet,
securityGroups: [sg],
iamInstanceProfile,
volumes: [volume],
},
});

Examples#

Properties#

Dependencies#

Update#

There are 2 kind of update depending on the attribute to modify:

  • Stop and Start: The instance is stopped, the attribute is changed, the instance is started.
  • Destroy and Create: The instance is destroyed and created with the new attributes.
AttributeDescriptionUpdate Kind
ImageIdThe Amazon Managed Image IdDestroy & Create
InstanceTypeThe Instance TypeStop & Start