Snowpark Container Services enables you to easily deploy, manage, and scale containerized applications.
After you upload your application image to a repository in your account, you run your application containers
as a service or a job. This topic explains working with services.
A service is long-running, like a web service, and does not end on its own. Snowflake manages running services.
For example, if a service container exits, for whatever reason, Snowflake restarts that container so the service
runs uninterrupted. If your service needs more resources, such as more compute power, Snowflake provisions
additional nodes in the compute pool.
The following table describes the properties of a compute pool project definition.
Compute pool project definition properties
Property
Definition
type
required, string
Must be service.
stage
required, string
Stage where the service specification file is located.
compute_pool
required, string
Compute pool where the service runs.
spec_file
required, string
Path to service specification file on the stage.
identifier
optional, string
Snowflake identifier for the entity. The value can have the following forms:
String identifier text
identifier:my-service
Both unquoted and quoted identifiers are supported. To use quoted identifiers, include the surrounding quotes in the YAML value (for example, ’”My Image Repository").
An error occurs if you specify a schema or database and use a fully qualified name in the name property (such as mydb.schema1.my-app).
min_instances
optional, string
Minimum number of service instances to run.
Default: 1
max_instances
optional, string
Maximum number of service instances to run.
query_warehouse
optional, string
Warehouse to use if a service container connects to Snowflake to execute a query without explicitly specifying a warehouse to use.
auto_resume
optional, string
Whether to automatically resume when a service function or ingress is called.
Default: True
external_access_integrations
optional, string sequence
Names of external access integrations needed for this entity to access external networks.
secrets
optional, dictionary
Names and values of secrets variables so that you can use the variables to reference the secrets.
artifacts
optional, string sequence
List of file source and destination pairs to add to the deploy root. You can use the following artifact properties:
src: Path to the code source file or files
dest: Path to the directory to deploy the artifacts.
Destination paths that reference directories must end with a /. A glob pattern’s destination that does not end with a / results in an error. If omitted, dest defaults to the same string as src.
You can also pass in a string for each item instead of a dict, in which case the value is treated as both src and dest.
If src refers to just one file (not a glob), dest can refer to a target <path> or a <path/name>.
You can also pass in a string for each item instead of a dict, in which case the value is treated as both src and dest.
comment
optional, string
Comments to associate with the compute pool.
tags
optional, Tag sequence
Tag names and values for the compute pool. For more information, see Tag quotas
To create and deploy a service, do the following:
Change your current directory to the directory containing the project definition file.
Run a snow spcs service deploy command similar to the following:
snow spcs servicedeploy
+---------------------------------------------------------------------+|key|value||--------+------------------------------------------------------------|| status |Service MY_SERVICE successfully created.|+---------------------------------------------------------------------+
+-------------------------------------------+|key|value||--------+----------------------------------|| status |Statement executed successfully.|+-------------------------------------------+
To resume a suspended service, enter a snow spcs service resume command similar to the following:
snow spcs serviceresume echo_service
+-------------------------------------------+|key|value||--------+----------------------------------|| status |Statement executed successfully.|+-------------------------------------------+
The snow spcs service list command returns an overview of all services, including the runtime state of the services, such as PENDING or RUNNING, and the upgrading status. To get the status of all services, enter a command similar to the following:
You can list service’s instances and containers with the snow spcs service list-instances and snow spcs service list-containers commands, respectively.
You can manage access to individual endpoints exposed by a service by defining service roles and permissions in the service specification. For more information about how to use service roles, see GRANT SERVICE ROLE.
+-------------------------------------------+|key|value||--------+----------------------------------|| status |Statement executed successfully.|+-------------------------------------------+
To reset a service’s property or parameter to its default value, enter a command similar to the following:
+-------------------------------------------+|key|value||--------+----------------------------------|| status |Statement executed successfully.|+-------------------------------------------+
+-------------------------------------------+|key|value||--------+----------------------------------|| status |Statement executed successfully.|+-------------------------------------------+