diff --git a/docs/compute/launching-instances/README.md b/docs/compute/launching-instances/README.md index fe6635234..c17c645b5 100644 --- a/docs/compute/launching-instances/README.md +++ b/docs/compute/launching-instances/README.md @@ -22,11 +22,12 @@ resources: - [Overview](#overview) - [Launch](#launch) - [Manage](#manage) -- [Reboot](#reboot) - [Modify Instance Attributes](#modify-instance-attributes) +- [Instance Metadata Options](#instance-metadata-options) +- [Spot Instances](#spot-instances) - [Console Output](#console-output) - [Instance Types](#instance-types) -- [SSH (Development)](#ssh-development) +- [SSH](#ssh) - [Troubleshooting](#troubleshooting) - [Instance Fails to Boot](#instance-fails-to-boot) - [Cannot SSH Into Instance](#cannot-ssh-into-instance) @@ -40,13 +41,15 @@ Spinifex provides EC2-compatible VM management built on QEMU/KVM. Instances supp **Supported operations:** - `run-instances` — Launch new VMs -- `describe-instances` — Query state +- `describe-instances` / `describe-instance-status` / `describe-instance-attribute` — Query state - `stop-instances` / `start-instances` — Lifecycle - `reboot-instances` — In-place restart - `terminate-instances` — Permanent removal -- `modify-instance-attribute` — Change type, user data, or source/dest check +- `modify-instance-attribute` — Change instance type, user data, or termination protection +- `modify-instance-metadata-options` — IMDS settings (IMDSv2 is always enforced) +- `request-spot-instances` / `describe-spot-instance-requests` / `cancel-spot-instance-requests` — Spot instance requests - `get-console-output` — Retrieve serial console log -- `describe-instance-types` — List available instance types +- `describe-instance-types` — List available instance types and capacity ## Instructions @@ -61,18 +64,20 @@ export AWS_PROFILE=spinifex ## Launch ```bash -aws ec2 run-instances \ +INSTANCE_ID=$(aws ec2 run-instances \ --image-id $SPINIFEX_AMI \ --instance-type t3.small \ - --key-name spinifex-key - -export INSTANCE_ID="i-XXX" + --key-name spinifex-key \ + --query 'Instances[0].InstanceId' --output text) ``` +Other supported launch flags: `--subnet-id`, `--security-group-ids`, `--tag-specifications`, `--user-data`, `--iam-instance-profile`, `--block-device-mappings`, `--placement`, `--count`. + ## Manage ```bash aws ec2 describe-instances --instance-ids $INSTANCE_ID +aws ec2 describe-instance-status --instance-ids $INSTANCE_ID --include-all-instances aws ec2 stop-instances --instance-ids $INSTANCE_ID aws ec2 start-instances --instance-ids $INSTANCE_ID aws ec2 terminate-instances --instance-ids $INSTANCE_ID @@ -81,7 +86,7 @@ aws ec2 reboot-instances --instance-ids $INSTANCE_ID ## Modify Instance Attributes -Change instance type, user data, or source/dest check. Instance type and user data require the instance to be **stopped** first. +Change instance type, user data, or termination protection. Instance type and user data require the instance to be **stopped** first. ### Change Instance Type @@ -95,6 +100,37 @@ aws ec2 modify-instance-attribute \ aws ec2 start-instances --instance-ids $INSTANCE_ID ``` +### Termination Protection + +```bash +aws ec2 modify-instance-attribute \ + --instance-id $INSTANCE_ID \ + --disable-api-termination +``` + +## Instance Metadata Options + +IMDSv2 is always enforced — `--http-tokens optional` and `--http-endpoint disabled` are rejected with `UnsupportedOperation`, matching AWS account-level IMDSv2 enforcement. The hop limit is adjustable (raise it for containerised workloads that reach IMDS through an extra network hop): + +```bash +aws ec2 modify-instance-metadata-options \ + --instance-id $INSTANCE_ID \ + --http-put-response-hop-limit 2 +``` + +## Spot Instances + +Spot requests are supported as a compatibility layer over the on-demand path: requests launch real VMs on your own compute immediately and report `active`/`fulfilled`. There is no spot market — no bidding, interruption, or reclamation. + +```bash +aws ec2 request-spot-instances \ + --instance-count 1 \ + --launch-specification '{"ImageId":"'$SPINIFEX_AMI'","InstanceType":"t3.small","KeyName":"spinifex-key"}' + +aws ec2 describe-spot-instance-requests +aws ec2 cancel-spot-instance-requests --spot-instance-request-ids $SIR_ID +``` + ## Console Output Retrieve the serial console log for a running instance. Output is base64-encoded. @@ -121,7 +157,8 @@ aws ec2 describe-instance-types Filter to a specific type: ```bash -aws ec2 describe-instance-types --instance-types t3.micro t3.small +aws ec2 describe-instance-types \ + --query "InstanceTypes[?InstanceType=='t3.small']" ``` Show capacity (how many of each type can still be launched): diff --git a/docs/migration/moving-aws-workload/README.md b/docs/migration/moving-aws-workload/README.md index 02406c365..c88bea706 100644 --- a/docs/migration/moving-aws-workload/README.md +++ b/docs/migration/moving-aws-workload/README.md @@ -31,9 +31,9 @@ resources: Spinifex provides drop-in compatibility with AWS APIs, making it possible to migrate existing workloads with minimal changes. -**Supported Services:** VPC, EC2, EBS, S3, IAM +**Supported Services:** EC2, VPC, EBS, S3, IAM, STS, ELBv2 (ALB/NLB), ACM, ECR, ECS, EKS -**Compatible Tools:** AWS CLI, AWS SDKs, Terraform, any S3-compatible client +**Compatible Tools:** AWS CLI, AWS SDKs, Terraform, kubectl (via `aws eks get-token`), any S3-compatible client ## Instructions @@ -61,13 +61,21 @@ provider "aws" { secret_key = "your-spinifex-secret-key" endpoints { - ec2 = "https://localhost:9999" - s3 = "https://localhost:8443" + ec2 = "https://localhost:9999" + iam = "https://localhost:9999" + sts = "https://localhost:9999" + elbv2 = "https://localhost:9999" + acm = "https://localhost:9999" + ecr = "https://localhost:9999" + ecs = "https://localhost:9999" + eks = "https://localhost:9999" + s3 = "https://localhost:8443" } skip_credentials_validation = true skip_metadata_api_check = true skip_requesting_account_id = true + skip_region_validation = true } ``` @@ -81,12 +89,13 @@ aws s3 sync s3://local-bucket/ s3://cloud-bucket/ --source-region spinifex --reg ## Terraform Provider Errors -Ensure all three skip flags are set in your provider configuration: +Ensure all four skip flags are set in your provider configuration: ```hcl skip_credentials_validation = true skip_metadata_api_check = true skip_requesting_account_id = true +skip_region_validation = true ``` Without these, Terraform will try to validate credentials and metadata against real AWS endpoints.