Specifying a cloud network where the function will be executed
Written by
Updated at November 14, 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 specified cloud network.
Management console
CLI
API
- In the management console
, select the folder containing the 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_environment> \
--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 in<function_file_name>.<handler_name>
format.--memory
: Amount of RAM.--execution-timeout
: Maximum function running time before the timeout is reached.--source-version-id
: ID of the function version from which you want to copy the code.--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.