Specifying a cloud network where the function will be executed
Written by
Updated at February 28, 2024
You can specify a cloud network where the function will be executed.
A cloud network must meet the following conditions:
- Has subnets in all availability zones.
- Has at least one resource with an IP address in the given cloud network.
Management console
CLI
API
- In the management console
, select the folder containing your function. - Select Cloud Functions.
- Select a function.
- Go to the Editor tab.
- Under Parameters, in the Network field, choose a network for function execution.
- Click Save changes.
If you do not have the Yandex Cloud command line interface yet, install and initialize it.
The folder specified in the CLI profile is used by default. You can specify a different folder using the --folder-name
or --folder-id
parameter.
To specify a cloud network, run the command:
yc serverless function version create \
--function-name=<function_name> \
--runtime <runtime> \
--entrypoint <entry_point> \
--memory 128m \
--execution-timeout 5s \
--source-version-id <version_ID> \
--network-id <network_ID>
Where:
--function-name
: Function name.--runtime
: Runtime environment.--entrypoint
: Entry point specified in the<function_file_name>.<handler_name>
format.--memory
: Amount of RAM.--execution-timeout
: Maximum function execution time before the timeout is reached.--source-version-id
: ID of the function version to copy the code of.--network-id
: ID of a cloud network where the function will be executed.
To specify a cloud network, use the createVersion REST API method for the Function resource or the FunctionService/CreateVersion gRPC API call.