aliyun/aliyun-cli

aliyun-cli create encrypted system disk

tolikkk opened this issue · 4 comments

aliyun-cli version 3.0.149

Need to create ECS instance with encrypted system disk. Default service CMK is suitable for my purposes.

There is only the DataDisk encryption is described in API reference for CreateInstance operation. The same options for SystemDisk are not available.
https://www.alibabacloud.com/help/en/elastic-compute-service/latest/createinstance

  --DataDisk.n.EncryptAlgorithm      String  Optional
  --DataDisk.n.Encrypted             Boolean Optional

How can I encrypt a system disk using ECS API?

Add --force at the end of the command.

@TsinghuaDream, thers is no such option "--force" in CreateInstance options:
https://www.alibabacloud.com/help/en/elastic-compute-service/latest/createinstance

Can you show the full command example?

aliyun ecs CreateInstance --{parameterName} {parameterValue} ... --force
you can use aliyun --help find --force option.

@TsinghuaDream, I used the following command with "force", still no success - created system disk is not encrypted.

aliyun ecs CreateInstance \
    --InstanceName test-host-1 \
    --HostName ali-test-13 \
    --ImageId ubuntu_22_04_x64_20G_alibase_20230208.vhd \
    --InstanceType ecs.c7.large \
    --SystemDisk.Category cloud_essd \
    --SystemDisk.PerformanceLevel PL0 \
    --SystemDisk.Size 40 \
    --SecurityGroupId sg-*** \
    --VSwitchId vsw-*** \
    --InternetChargeType PayByTraffic \
    --Tag.1.Key team \
    --Tag.1.Value test \
    --Tag.2.Key env \
    --Tag.2.Value dev \
    --Password *** \
    --force

Screenshot 2023-03-02 at 13 01 30