---
title: blossom service:create
url: /docs/reference/cli/service/create/
canonical_url: https://blossom88.com/docs/reference/cli/service/create/
markdown_url: https://blossom88.com/docs/reference/cli/service/create.md
summary: Create a service
categories:
  - cli
  - reference
---

# blossom service:create

Create a service

## Usage

    blossom service:create [--data DATA]

## Flags

| Flag | Description |
| --- | --- |
| `--data, -d` | YAML or JSON data, a path to a data file, or an HTTP(S) URL |

Guide: [Service configuration](https://blossom88.com/docs/reference/cli/service/create/#configuration)

Examples:

    blossom service:create --data service.yml

service.yml:

```yaml
service:
  environment_id: environment-100
  name: web
  command: bundle exec puma
  port: 3000
  publicly_exposed: true
```

Deploy the Environment to apply the new Service.

## Configuration

A Service is a long-running application workload in an Environment. Use one
Service for each independently scalable process such as `web`, `worker`, or
`scheduler`.

Create a starter file:

    blossom service:init

It writes service.yml:

```yaml
service:
  environment_id: environment-100 # replace with your environment id
  name: web
  # image: docker.io/library/nginx:stable # optional; blank inherits the Environment image
  command: bundle exec puma # omit with an image to use its default command
  port: 3000
  publicly_exposed: true
  desired_size: 1
  health_check:
    enabled: false
    kind: http
    path: /ready
    traffic: true
  resources:
    preset: small # micro, small, medium, large, x-large, 2x-large, 4x-large, 8x-large, or custom
```

Create the Service:

    blossom service:create --data service.yml

The Environment supplies the default deployed image and Environment variables.
Environment Links add private Database and Cache connection URLs to every
Service in the Environment.

## Choose a Service Image

For a Service that uses a different image, set `image`:

```yaml
service:
  environment_id: environment-100
  name: frontend
  image: docker.io/library/nginx:stable
  port: 80
  publicly_exposed: true
```

Use a full registry, repository, and tag or digest. Link a private Container
Registry to the Environment before deploying a private image. A blank
`command` uses that image's default command; set `command` and optionally
`entrypoint` to change how it starts.

Custom tags resolve to digests for the Release. Restart, scaling, and rollback
reuse those images. Image changes take effect on the next deployment.
Clear `image` and set your application command to inherit the Environment
image again. Release hooks and Jobs using the Environment Release keep its
default image.

## Health and Resources

The health check belongs to this Service because it verifies this process and
port. Blossom uses the same definition to hold a new Release until its
Containers are ready and, when `traffic` is enabled, to stop routing to an
unhealthy Container. Private workers can use `kind: command` with a command
that exits successfully when the process is healthy.

Choose CPU and memory for each Container with `resources.preset`.
The default is `small`.

| Preset | CPU | Memory |
| --- | --- | --- |
| `micro` | 0.25 vCPU | 437.5 MB |
| `small` | 0.5 vCPU | 875 MB |
| `medium` | 1 vCPU | 1.75 GB |
| `large` | 2 vCPU | 3.5 GB |
| `x-large` | 4 vCPU | 7.8 GB |
| `2x-large` | 8 vCPU | 15.6 GB |
| `4x-large` | 16 vCPU | 31.2 GB |
| `8x-large` | 32 vCPU | 62.4 GB |

For a custom allocation, set CPU and memory directly:

```yaml
  resources:
    preset: custom
    cpu_vcpus: 1.5
    memory_gb: 3
```

Custom allocations require at least `0.05 vCPU` and `67,108,864 bytes`. CPU
uses `0.05 vCPU` increments; memory uses decimal GB with whole-byte precision.
Blossom rejects
unsupported values instead of rounding them. A custom Container above 3.5 GB
selects a larger physical Server shape; Blossom never combines several smaller
Servers to pretend that one Container fits. These values determine Container
limits and the Blossom charge.

Use [Databases](/docs/databases/) or
[Caches](/docs/caches/) for supported data engines. They use their
own managed-data lifecycle rather than application Service scaling.

## Persistent Services

For a custom single-writer workload, add this under `service`:

```yaml
  storage:
    size_gib: 10
    mount_path: /data
    availability: shared
```

Keep `desired_size: 1`. Shared runs on your own Persistent Capacity; `dedicated`
reserves compute for this Service. Each keeps its own Volume. Deployments stop
the previous writer first, and replacement can interrupt availability. Storage
survival is not an application backup.

Increase `size_gib` to grow a ready Volume. Its size can only grow and its mount
path is fixed. Use [service:stop](/docs/reference/cli/service/stop/)
to keep the Service and Volume, or pass
[`--storage delete`](/docs/reference/cli/service/delete/) to
permanently remove both.

### Reuse A Volume

Release the Volume first, then create a stopped Service in the same Environment
and Location. Omit `size_gib` when selecting an existing Volume:

```yaml
service:
  environment_id: environment-100
  name: restored
  enabled: false
  desired_size: 0
  storage:
    volume_id: volume-100
    mount_path: /data
    availability: shared
```

Set the image and command for the application that owns the data, then deploy
when ready. For an existing stopped Service, use
[volume:attach](/docs/reference/cli/volume/attach/).
