Provision an Alibaba Cloud Spot ECS Instance
Use the bundled CLI wrapper to preserve the fragile ordering and evidence trail of a spot purchase. Keep account-specific IDs, IP addresses, image dates, and prices out of the skill.
Preconditions
- Require Alibaba Cloud CLI v3 and credentials with least-privilege ECS and VPC permissions.
- Treat
plan as read-only and run it before every apply.
- Obtain an explicit region. Obtain an explicit SSH source CIDR when public SSH is requested.
- Explain that spot capacity and price can change between planning and creation.
- Write all evidence beneath
output/aliyun-ecs-spot-provision/<name>/.
Workflow
- Run
plan to discover exact CPU/memory matches, select an available zone and instance type, resolve a current Ubuntu image, verify a disk category, and query the current hourly quote.
- Review
plan.json. Report compute, disk, and fixed bandwidth prices separately; pay-by-traffic outbound transfer is not an hourly fixed charge.
- Run
apply --confirm-create only after the requested region, size, disk, public bandwidth, SSH CIDR, and release behavior are settled.
- Let the script create or reuse a VPC, vSwitch, security group, and key pair. Never print or commit the private key.
- Require the
RunInstances dry run to return DryRunOperation before submitting the real request.
- Verify the returned instance with
DescribeInstances until it reaches Running.
- Report all created IDs, the private-key path, current quote, verification evidence, and remaining interruption/data-retention risks.
Do not automatically delete partially created infrastructure after an error. Preserve state.json, diagnose, and resume with the same command so resource IDs are reused.
Commands
Read-only plan:
python3 skills/compute/ecs/aliyun-ecs-spot-provision/scripts/provision_spot_ecs.py plan \
--name batch-worker \
--region ap-southeast-8 \
--cpu 8 \
--memory-gib 16 \
--system-disk-size 800 \
--internet-bandwidth-out 5 \
--ssh-cidr 203.0.113.10/32
Create exactly one instance from the saved plan:
python3 skills/compute/ecs/aliyun-ecs-spot-provision/scripts/provision_spot_ecs.py apply \
--name batch-worker \
--region ap-southeast-8 \
--cpu 8 \
--memory-gib 16 \
--system-disk-size 800 \
--internet-bandwidth-out 5 \
--ssh-cidr 203.0.113.10/32 \
--confirm-create
Prefer --instance-type and --zone when the user chooses an exact offer. Use --auto-release-time for a true scheduled release; --spot-duration 1 is only a one-hour protection period.
Safety Rules
- Never infer
0.0.0.0/0 for SSH. Require an explicit CIDR for public SSH.
- Default public bandwidth to zero. A public IP is requested only when
--internet-bandwidth-out is positive.
- Generate a new RSA private key with mode
0600; fail instead of overwriting an existing key.
- Use automatic spot bidding by default. Use
--spot-price-limit only when the user supplies a maximum hourly compute price.
- Set the system-disk size during creation. For resizing an existing disk and filesystem, use
aliyun-ecs-manage instead.
- Warn that a system disk created with the instance is normally released with a reclaimed spot instance.
- Never equate
ExpiredTime=2099... or SpotDuration=1 with a scheduled deletion.
References
Read references/operations.md when diagnosing partial creation, interpreting prices, configuring release behavior, or validating the guest filesystem.
See references/sources.md for the official ECS and VPC documentation checked for this skill.
Output And Evidence
- Save the resolved request and current quote to
output/aliyun-ecs-spot-provision/<name>/plan.json.
- Save every CLI response and error stream beside the plan using operation-specific names.
- Save created resource IDs and recovery state to
state.json; save the final normalized result to summary.json.
- Store generated private keys only below the evidence directory's
private/ folder with directory mode 0700 and key mode 0600.
- Never copy private keys, AccessKeys, or credential files into reports or committed fixtures.
Validation
python3 -m py_compile skills/compute/ecs/aliyun-ecs-spot-provision/scripts/provision_spot_ecs.py
python3 skills/compute/ecs/aliyun-ecs-spot-provision/scripts/provision_spot_ecs.py --help
python3 /home/vipas/.codex/skills/.system/skill-creator/scripts/quick_validate.py \
skills/compute/ecs/aliyun-ecs-spot-provision
1---2name: aliyun-ecs-spot-provision3description: Plan, price, provision, and verify one Alibaba Cloud ECS spot instance with minimal VPC networking, restricted SSH access, a managed key pair, configurable system-disk size, and optional scheduled release. Use when Codex must buy, launch, or reproduce a complete preemptible/spot ECS workflow rather than only manage an existing instance.4---5
6# Provision an Alibaba Cloud Spot ECS Instance
7
8Use the bundled CLI wrapper to preserve the fragile ordering and evidence trail of a spot purchase. Keep account-specific IDs, IP addresses, image dates, and prices out of the skill.
9
10## Preconditions
11
12- Require Alibaba Cloud CLI v3 and credentials with least-privilege ECS and VPC permissions.
13- Treat `plan` as read-only and run it before every `apply`.
14- Obtain an explicit region. Obtain an explicit SSH source CIDR when public SSH is requested.
15- Explain that spot capacity and price can change between planning and creation.
16- Write all evidence beneath `output/aliyun-ecs-spot-provision/<name>/`.
17
18## Workflow
19
201. Run `plan` to discover exact CPU/memory matches, select an available zone and instance type, resolve a current Ubuntu image, verify a disk category, and query the current hourly quote.
212. Review `plan.json`. Report compute, disk, and fixed bandwidth prices separately; pay-by-traffic outbound transfer is not an hourly fixed charge.
223. Run `apply --confirm-create` only after the requested region, size, disk, public bandwidth, SSH CIDR, and release behavior are settled.
234. Let the script create or reuse a VPC, vSwitch, security group, and key pair. Never print or commit the private key.
245. Require the `RunInstances` dry run to return `DryRunOperation` before submitting the real request.
256. Verify the returned instance with `DescribeInstances` until it reaches `Running`.
267. Report all created IDs, the private-key path, current quote, verification evidence, and remaining interruption/data-retention risks.
27
28Do not automatically delete partially created infrastructure after an error. Preserve `state.json`, diagnose, and resume with the same command so resource IDs are reused.
29
30## Commands
31
32Read-only plan:
33
34```bash
35python3 skills/compute/ecs/aliyun-ecs-spot-provision/scripts/provision_spot_ecs.py plan \
36 --name batch-worker \
37 --region ap-southeast-8 \
38 --cpu 8 \
39 --memory-gib 16 \
40 --system-disk-size 800 \
41 --internet-bandwidth-out 5 \
42 --ssh-cidr 203.0.113.10/32
43```
44
45Create exactly one instance from the saved plan:
46
47```bash
48python3 skills/compute/ecs/aliyun-ecs-spot-provision/scripts/provision_spot_ecs.py apply \
49 --name batch-worker \
50 --region ap-southeast-8 \
51 --cpu 8 \
52 --memory-gib 16 \
53 --system-disk-size 800 \
54 --internet-bandwidth-out 5 \
55 --ssh-cidr 203.0.113.10/32 \
56 --confirm-create
57```
58
59Prefer `--instance-type` and `--zone` when the user chooses an exact offer. Use `--auto-release-time` for a true scheduled release; `--spot-duration 1` is only a one-hour protection period.
60
61## Safety Rules
62
63- Never infer `0.0.0.0/0` for SSH. Require an explicit CIDR for public SSH.
64- Default public bandwidth to zero. A public IP is requested only when `--internet-bandwidth-out` is positive.
65- Generate a new RSA private key with mode `0600`; fail instead of overwriting an existing key.
66- Use automatic spot bidding by default. Use `--spot-price-limit` only when the user supplies a maximum hourly compute price.
67- Set the system-disk size during creation. For resizing an existing disk and filesystem, use `aliyun-ecs-manage` instead.
68- Warn that a system disk created with the instance is normally released with a reclaimed spot instance.
69- Never equate `ExpiredTime=2099...` or `SpotDuration=1` with a scheduled deletion.
70
71## References
72
73Read [references/operations.md](references/operations.md) when diagnosing partial creation, interpreting prices, configuring release behavior, or validating the guest filesystem.
74See [references/sources.md](references/sources.md) for the official ECS and VPC documentation checked for this skill.
75
76## Output And Evidence
77
78- Save the resolved request and current quote to `output/aliyun-ecs-spot-provision/<name>/plan.json`.
79- Save every CLI response and error stream beside the plan using operation-specific names.
80- Save created resource IDs and recovery state to `state.json`; save the final normalized result to `summary.json`.
81- Store generated private keys only below the evidence directory's `private/` folder with directory mode `0700` and key mode `0600`.
82- Never copy private keys, AccessKeys, or credential files into reports or committed fixtures.
83
84## Validation
85
86```bash
87python3 -m py_compile skills/compute/ecs/aliyun-ecs-spot-provision/scripts/provision_spot_ecs.py
88python3 skills/compute/ecs/aliyun-ecs-spot-provision/scripts/provision_spot_ecs.py --help
89python3 /home/vipas/.codex/skills/.system/skill-creator/scripts/quick_validate.py \
90 skills/compute/ecs/aliyun-ecs-spot-provision
91```