Create Machine
Create a Machine within a specific app using the details provided in the request body. **Important**: This request can fail, and you’re responsible for handling that failure. If you ask for a large Machine, or a Machine in a region we happen to be at capacity for, you might need to retry the request, or to fall back to another region. If you’re working directly with the Machines API, you’re taking some responsibility for your own orchestration!
Create a Machine within a specific app using the details provided in the request body.
Important: This request can fail, and you’re responsible for handling that failure. If you ask for a large Machine, or a Machine in a region we happen to be at capacity for, you might need to retry the request, or to fall back to another region. If you’re working directly with the Machines API, you’re taking some responsibility for your own orchestration!
Authorization
bearerAuth A Fly.io access token. Create one with fly tokens create.
In: header
Path Parameters
Fly App Name
Request Body
application/json
Create machine request
An object defining the Machine configuration
Unique name for this Machine. If omitted, one is generated for you
The target region. Omitting this param launches in the same region as your WireGuard peer connection (somewhere near you).
Response Body
application/json
curl -X POST "https://example.com/apps/string/machines" \ -H "Content-Type: application/json" \ -d '{}'{ "checks": [ { "name": "string", "output": "string", "status": "string", "updated_at": "string" } ], "config": { "auto_destroy": true, "cache_drive": { "size_mb": 0 }, "checks": { "property1": { "grace_period": "1s", "headers": [ { "name": "string", "values": [ "string" ] } ], "interval": "15s", "kind": "informational", "method": "string", "path": "string", "port": 0, "protocol": "string", "timeout": "2s", "tls_server_name": "string", "tls_skip_verify": true, "type": "string" }, "property2": { "grace_period": "1s", "headers": [ { "name": "string", "values": [ "string" ] } ], "interval": "15s", "kind": "informational", "method": "string", "path": "string", "port": 0, "protocol": "string", "timeout": "2s", "tls_server_name": "string", "tls_skip_verify": true, "type": "string" } }, "containers": [ { "cmd": [ "string" ], "depends_on": [ { "condition": {}, "name": "string" } ], "entrypoint": [ "string" ], "env": { "property1": "string", "property2": "string" }, "env_from": [ { "env_var": "string", "field_ref": "id" } ], "exec": [ "string" ], "files": [ { "guest_path": "string", "image_config": "string", "mode": 0, "raw_value": "string", "secret_name": "string" } ], "healthchecks": [ { "exec": { "command": [ "string" ] }, "failure_threshold": 0, "grace_period": 0, "http": { "headers": [ { "name": "string", "values": [ "string" ] } ], "method": "string", "path": "string", "port": 0, "scheme": {}, "tls_server_name": "string", "tls_skip_verify": true }, "interval": 0, "kind": {}, "name": "string", "success_threshold": 0, "tcp": { "port": 0 }, "timeout": 0, "unhealthy": {} } ], "image": "string", "name": "string", "restart": { "gpu_bid_price": 0, "max_retries": 0, "policy": "no" }, "secrets": [ { "env_var": "string", "name": "string" } ], "stop": { "signal": "SIGHUP", "timeout": "10s" }, "user": "string" } ], "disable_machine_autostart": true, "dns": { "dns_forward_rules": [ { "addr": "string", "basename": "string" } ], "hostname": "string", "hostname_fqdn": "string", "nameservers": [ "string" ], "options": [ { "name": "string", "value": "string" } ], "searches": [ "string" ], "skip_registration": true }, "env": { "property1": "string", "property2": "string" }, "files": [ { "guest_path": "string", "image_config": "string", "mode": 0, "raw_value": "string", "secret_name": "string" } ], "guest": { "cpu_kind": "string", "cpus": 0, "gpu_kind": "string", "gpus": 0, "host_dedication_id": "string", "kernel_args": [ "string" ], "max_memory_mb": 0, "memory_mb": 0, "persist_rootfs": "never" }, "image": "string", "init": { "cmd": [ "string" ], "entrypoint": [ "string" ], "exec": [ "string" ], "kernel_args": [ "string" ], "swap_size_mb": 0, "tty": true }, "metadata": { "property1": "string", "property2": "string" }, "metrics": { "https": true, "path": "string", "port": 0 }, "mounts": [ { "add_size_gb": 0, "encrypted": true, "extend_threshold_percent": 0, "name": "string", "path": "string", "size_gb": 0, "size_gb_limit": 0, "volume": "string" } ], "processes": [ { "cmd": [ "string" ], "entrypoint": [ "string" ], "env": { "property1": "string", "property2": "string" }, "env_from": [ { "env_var": "string", "field_ref": "id" } ], "exec": [ "string" ], "ignore_app_secrets": true, "secrets": [ { "env_var": "string", "name": "string" } ], "user": "string" } ], "restart": { "gpu_bid_price": 0, "max_retries": 0, "policy": "no" }, "rootfs": { "persist": "never", "size_gb": 0 }, "schedule": "string", "services": [ { "autostart": true, "autostop": "off", "checks": [ { "grace_period": "1s", "headers": [ { "name": "string", "values": [ "string" ] } ], "interval": "15s", "method": "string", "path": "string", "port": 0, "protocol": "string", "timeout": "2s", "tls_server_name": "string", "tls_skip_verify": true, "type": "string" } ], "concurrency": { "hard_limit": 0, "soft_limit": 0, "type": "string" }, "force_instance_description": "string", "force_instance_key": "string", "internal_port": 0, "min_machines_running": 0, "ports": [ { "end_port": 0, "force_https": true, "handlers": [ "string" ], "http_options": { "compress": true, "h2_backend": true, "headers_read_timeout": 0, "idle_timeout": 0, "replay_cache": [ { "allow_bypass": true, "name": "string", "path_prefix": "string", "ttl_seconds": 0, "type": "cookie" } ], "response": { "headers": { "property1": {}, "property2": {} }, "pristine": true } }, "port": 0, "proxy_proto_options": { "version": "string" }, "start_port": 0, "tls_options": { "alpn": [ "string" ], "default_self_signed": true, "versions": [ "string" ] } } ], "protocol": "string" } ], "size": "string", "spot": { "max_price_fraction": 0 }, "standbys": [ "string" ], "statics": [ { "guest_path": "string", "index_document": "string", "tigris_bucket": "string", "url_prefix": "string" } ], "stop_config": { "signal": "SIGHUP", "timeout": "10s" } }, "cordoned": true, "created_at": "string", "events": [ { "id": "string", "request": {}, "source": "string", "status": "string", "timestamp": 0, "type": "string" } ], "host_status": "ok", "id": "string", "image_ref": { "digest": "string", "labels": { "property1": "string", "property2": "string" }, "registry": "string", "repository": "string", "tag": "string" }, "incomplete_config": { "auto_destroy": true, "cache_drive": { "size_mb": 0 }, "checks": { "property1": { "grace_period": "1s", "headers": [ { "name": "string", "values": [ "string" ] } ], "interval": "15s", "kind": "informational", "method": "string", "path": "string", "port": 0, "protocol": "string", "timeout": "2s", "tls_server_name": "string", "tls_skip_verify": true, "type": "string" }, "property2": { "grace_period": "1s", "headers": [ { "name": "string", "values": [ "string" ] } ], "interval": "15s", "kind": "informational", "method": "string", "path": "string", "port": 0, "protocol": "string", "timeout": "2s", "tls_server_name": "string", "tls_skip_verify": true, "type": "string" } }, "containers": [ { "cmd": [ "string" ], "depends_on": [ { "condition": {}, "name": "string" } ], "entrypoint": [ "string" ], "env": { "property1": "string", "property2": "string" }, "env_from": [ { "env_var": "string", "field_ref": "id" } ], "exec": [ "string" ], "files": [ { "guest_path": "string", "image_config": "string", "mode": 0, "raw_value": "string", "secret_name": "string" } ], "healthchecks": [ { "exec": { "command": [ "string" ] }, "failure_threshold": 0, "grace_period": 0, "http": { "headers": [ { "name": "string", "values": [ "string" ] } ], "method": "string", "path": "string", "port": 0, "scheme": {}, "tls_server_name": "string", "tls_skip_verify": true }, "interval": 0, "kind": {}, "name": "string", "success_threshold": 0, "tcp": { "port": 0 }, "timeout": 0, "unhealthy": {} } ], "image": "string", "name": "string", "restart": { "gpu_bid_price": 0, "max_retries": 0, "policy": "no" }, "secrets": [ { "env_var": "string", "name": "string" } ], "stop": { "signal": "SIGHUP", "timeout": "10s" }, "user": "string" } ], "disable_machine_autostart": true, "dns": { "dns_forward_rules": [ { "addr": "string", "basename": "string" } ], "hostname": "string", "hostname_fqdn": "string", "nameservers": [ "string" ], "options": [ { "name": "string", "value": "string" } ], "searches": [ "string" ], "skip_registration": true }, "env": { "property1": "string", "property2": "string" }, "files": [ { "guest_path": "string", "image_config": "string", "mode": 0, "raw_value": "string", "secret_name": "string" } ], "guest": { "cpu_kind": "string", "cpus": 0, "gpu_kind": "string", "gpus": 0, "host_dedication_id": "string", "kernel_args": [ "string" ], "max_memory_mb": 0, "memory_mb": 0, "persist_rootfs": "never" }, "image": "string", "init": { "cmd": [ "string" ], "entrypoint": [ "string" ], "exec": [ "string" ], "kernel_args": [ "string" ], "swap_size_mb": 0, "tty": true }, "metadata": { "property1": "string", "property2": "string" }, "metrics": { "https": true, "path": "string", "port": 0 }, "mounts": [ { "add_size_gb": 0, "encrypted": true, "extend_threshold_percent": 0, "name": "string", "path": "string", "size_gb": 0, "size_gb_limit": 0, "volume": "string" } ], "processes": [ { "cmd": [ "string" ], "entrypoint": [ "string" ], "env": { "property1": "string", "property2": "string" }, "env_from": [ { "env_var": "string", "field_ref": "id" } ], "exec": [ "string" ], "ignore_app_secrets": true, "secrets": [ { "env_var": "string", "name": "string" } ], "user": "string" } ], "restart": { "gpu_bid_price": 0, "max_retries": 0, "policy": "no" }, "rootfs": { "persist": "never", "size_gb": 0 }, "schedule": "string", "services": [ { "autostart": true, "autostop": "off", "checks": [ { "grace_period": "1s", "headers": [ { "name": "string", "values": [ "string" ] } ], "interval": "15s", "method": "string", "path": "string", "port": 0, "protocol": "string", "timeout": "2s", "tls_server_name": "string", "tls_skip_verify": true, "type": "string" } ], "concurrency": { "hard_limit": 0, "soft_limit": 0, "type": "string" }, "force_instance_description": "string", "force_instance_key": "string", "internal_port": 0, "min_machines_running": 0, "ports": [ { "end_port": 0, "force_https": true, "handlers": [ "string" ], "http_options": { "compress": true, "h2_backend": true, "headers_read_timeout": 0, "idle_timeout": 0, "replay_cache": [ { "allow_bypass": true, "name": "string", "path_prefix": "string", "ttl_seconds": 0, "type": "cookie" } ], "response": { "headers": { "property1": {}, "property2": {} }, "pristine": true } }, "port": 0, "proxy_proto_options": { "version": "string" }, "start_port": 0, "tls_options": { "alpn": [ "string" ], "default_self_signed": true, "versions": [ "string" ] } } ], "protocol": "string" } ], "size": "string", "spot": { "max_price_fraction": 0 }, "standbys": [ "string" ], "statics": [ { "guest_path": "string", "index_document": "string", "tigris_bucket": "string", "url_prefix": "string" } ], "stop_config": { "signal": "SIGHUP", "timeout": "10s" } }, "instance_id": "string", "lease": { "description": "string", "expires_at": 0, "owner": "string" }, "name": "string", "nonce": "string", "private_ip": "string", "region": "string", "state": "string", "updated_at": "string"}