OpenMCF logoOpenMCF

Loading...

AliCloud EcsInstance

Deploy and manage Alibaba Cloud ECS compute instances with configurable instance types, disk encryption, data disks, public IP, spot pricing, and IAM role attachment.

Overview

AliCloudEcsInstance provisions a managed ECS virtual machine on Alibaba Cloud. It supports the full range of ECS instance families (general purpose, compute-optimized, memory-optimized, GPU, etc.), multiple disk categories (cloud_essd, cloud_ssd, cloud_efficiency), SSH key or password authentication, and flexible billing (PostPaid, PrePaid, Spot).

This component wraps a single alicloud_instance Terraform resource. Data disks are created inline using the resource's built-in data_disks block, keeping their lifecycle coupled to the instance.

Prerequisites

  • An Alibaba Cloud VPC with at least one VSwitch in the target region
  • At least one security group in the same VPC
  • An SSH key pair (recommended) or password for instance access
  • For encrypted disks: a KMS key in the same region
  • Alibaba Cloud credentials with ECS permissions

Quick Start

apiVersion: ali-cloud.openmcf.org/v1
kind: AliCloudEcsInstance
metadata:
  name: my-ecs
spec:
  region: cn-hangzhou
  instanceType: ecs.g7.large
  imageId: ubuntu_22_04_x64_20G_alibase_20230515.vhd
  vswitchId:
    value: vsw-abc123
  securityGroupIds:
    - value: sg-abc123
  keyName: my-keypair

Configuration Reference

Required Fields

FieldTypeDescription
regionstringAlibaba Cloud region (e.g., "cn-hangzhou")
vswitchIdStringValueOrRefVSwitch ID for network placement
securityGroupIdslist of StringValueOrRefSecurity group IDs (at least one)
instanceTypestringECS instance type (e.g., "ecs.g7.large")
imageIdstringOS image ID

Optional Fields

FieldTypeDefaultDescription
instanceNamestringmetadata.nameDisplay name (2-128 chars)
hostNamestringautoOS-level hostname
descriptionstring-Instance description (2-256 chars)
systemDisk.categorystringcloud_essdDisk type
systemDisk.sizeint40System disk size in GB
systemDisk.performanceLevelstring-PL0/PL1/PL2/PL3 (ESSD only)
systemDisk.encryptedboolfalseEnable disk encryption
systemDisk.kmsKeyIdstring-KMS key for encryption
dataDisks[].sizeintrequiredData disk size in GB
dataDisks[].categorystringcloud_essdDisk type
dataDisks[].namestring-Disk display name
dataDisks[].performanceLevelstring-PL0/PL1/PL2/PL3
dataDisks[].encryptedboolfalseEnable encryption
dataDisks[].kmsKeyIdstring-KMS key for encryption
dataDisks[].snapshotIdstring-Create from snapshot
dataDisks[].deleteWithInstancebooltrueDelete when instance released
keyNamestring-SSH key pair name
passwordstring-Login password (8-30 chars)
internetMaxBandwidthOutint0Outbound bandwidth in Mbps (>0 allocates public IP)
internetChargeTypestring-PayByTraffic or PayByBandwidth
instanceChargeTypestringPostPaidPostPaid or PrePaid
periodint-Subscription months (PrePaid)
periodUnitstring-Week or Month
spotStrategystring-NoSpot, SpotAsPriceGo, SpotWithPriceLimit
spotPriceLimitdouble-Max hourly price (spot only)
userDatastring-Cloud-init script (base64)
roleNamestring-RAM role for instance profile
deletionProtectionboolfalsePrevent accidental deletion
securityEnhancementStrategystring-Active or Deactive
resourceGroupIdstring-Resource group for organization
tagsmap-Key-value tags

Stack Outputs

OutputDescription
instance_idECS instance ID (e.g., "i-bp1xxxxx")
private_ipPrimary private IP address
public_ipPublic IP (empty if no public IP)

Related Components

  • AliCloudVpc -- VPC for network isolation
  • AliCloudVswitch -- VSwitch for subnet placement
  • AliCloudSecurityGroup -- Network access control rules
  • AliCloudEipAddress -- Elastic IP (alternative to auto-allocated public IP)
  • AliCloudKmsKey -- Encryption key for disk encryption
  • AliCloudRamRole -- IAM role for instance profile

Next article

AliCloud EIP Address

AliCloud EIP Address Deploys an Alibaba Cloud Elastic IP Address (EIP). The component provisions a standalone public IPv4 address that persists independently of any cloud resource, allowing it to be associated with and disassociated from NAT gateways, load balancers, VPN gateways, and ECS instances without changing the address. What Gets Created When you deploy an AliCloudEipAddress resource, OpenMCF provisions: EIP -- an alicloudeipaddress resource in the specified region with configurable...
Read next article
Presets
3 ready-to-deploy configurationsView presets →