CREATE APPLICATION SERVICE¶
Creates a new Application Service that deploys a packaged application build from an artifact repository.
An Application Service is a first-class Snowflake object. It manages its own compute, lifecycle, and access control. Unlike a Snowpark Container Services service, an Application Service deploys from a versioned package rather than from a user-supplied service specification.
- See also:
ALTER APPLICATION SERVICE , DESCRIBE APPLICATION SERVICE , DROP APPLICATION SERVICE , SHOW APPLICATION SERVICES
Syntax¶
Required parameters¶
nameSpecifies the identifier for the Application Service. The identifier must be unique for the schema where the service is created. For more details, see Identifier requirements.
The Application Service doesn’t share a namespace with SPCS
SERVICEobjects.FROM ARTIFACT REPOSITORY repository_name PACKAGE package_name
Specifies the artifact repository and package to deploy. The repository must be of type
APPLICATION.During public preview, you must include
FROM ARTIFACT REPOSITORY. Omitting the repository clause isn’t supported.
Optional parameters¶
VERSION version_aliasSpecifies the version of the package to deploy. You can pass a version name, such as
VERSION$3, or a version alias, such asLATESTorDEFAULT. If you don’t specify a version, Snowflake uses the package’s default version; if the package has no default version, the command returns an error.IN COMPUTE POOL compute_pool_nameSpecifies a Snowpark Container Services compute pool for the Application Service.
During Snowflake App Runtime public preview, managed compute pools are enforced by default: Snowflake uses the account-level managed pool for the service, and user-specified pool values aren’t used.
EXTERNAL_ACCESS_INTEGRATIONS = ( integration_name [ , ... ] )
Specifies the names of the external access integrations that allow the application to access external network locations. The names in this list are case-sensitive.
QUERY_WAREHOUSE = warehouse_nameSpecifies the warehouse used by the application when a container connects to Snowflake without explicitly specifying a warehouse.
AUTO_RESUME = { TRUE | FALSE }Specifies whether Snowflake automatically resumes the service when it receives an inbound request to one of its endpoints.
AUTO_SUSPEND_SECS = numSpecifies the number of seconds of inactivity after which Snowflake automatically suspends the Application Service. The minimum non-zero value is
300. A value of0disables auto-suspend.DEFAULT:
0(disabled)COMMENT = 'string_literal'Specifies a comment for the Application Service.
Access control requirements¶
If your role does not own the objects in the following table, then your role must have the listed privileges on those objects:
| Privilege | Object | Notes |
|---|---|---|
| CREATE APPLICATION SERVICE | Schema | Required to create a new Application Service in the schema. |
| READ | Artifact repository | Required on the artifact repository that contains the package. |
| USAGE | Compute pool | Required only when your account is configured to allow user-selected compute pools. During public preview, Snowflake uses the managed compute pool by default. |
| USAGE | External access integration | Required for each integration listed in EXTERNAL_ACCESS_INTEGRATIONS. |
| USAGE | Warehouse | Required if QUERY_WAREHOUSE is specified. |
Operating on an object in a schema requires at least one privilege on the parent database and at least one privilege on the parent schema.
For instructions on creating a custom role with a specified set of privileges, see Creating custom roles.
For general information about roles and privilege grants for performing SQL actions on securable objects, see Overview of Access Control.
Usage notes¶
- The Application Service starts automatically after creation. To check its status, use SHOW APPLICATION SERVICES or DESCRIBE APPLICATION SERVICE.
- During public preview, Snowflake runs Application Services on a managed
compute pool by default, including requests that specify
IN COMPUTE POOL. - To upgrade the service to a different package version, use
ALTER APPLICATION SERVICE with
UPGRADE. - Standalone SPCS SQL commands, such as
CREATE SERVICEandEXECUTE JOB SERVICE, aren’t used to manage an Application Service. UseAPPLICATION SERVICEcommands instead. CREATE OR REPLACEisn’t supported for Application Services.- You must specify
FROM ARTIFACT REPOSITORYwith the repository name. Commands that specify onlyFROM PACKAGEwithout a repository aren’t supported. - Snowflake App Runtime isn’t available on trial accounts.
- The OR REPLACE and IF NOT EXISTS clauses are mutually exclusive. They can’t both be used in the same statement.
-
CREATE OR REPLACE <object> statements are atomic. That is, when an object is replaced, the old object is deleted and the new object is created in a single transaction.
Examples¶
Deploy the default version of a package from an artifact repository:
Deploy a specific version:
Deploy the LATEST alias: