All Products
Search
Document Center

:GetFunction

Última atualização: Sep 09, 2026

Queries the information about a function.

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

The table below describes the authorization required to call this API. You can define it in a Resource Access Management (RAM) policy. The table's columns are detailed below:

  • Action: The actions can be used in the Action element of RAM permission policy statements to grant permissions to perform the operation.

  • API: The API that you can call to perform the action.

  • Access level: The predefined level of access granted for each API. Valid values: create, list, get, update, and delete.

  • Resource type: The type of the resource that supports authorization to perform the action. It indicates if the action supports resource-level permission. The specified resource must be compatible with the action. Otherwise, the policy will be ineffective.

    • For APIs with resource-level permissions, required resource types are marked with an asterisk (*). Specify the corresponding Alibaba Cloud Resource Name (ARN) in the Resource element of the policy.

    • For APIs without resource-level permissions, it is shown as All Resources. Use an asterisk (*) in the Resource element of the policy.

  • Condition key: The condition keys defined by the service. The key allows for granular control, applying to either actions alone or actions associated with specific resources. In addition to service-specific condition keys, Alibaba Cloud provides a set of common condition keys applicable across all RAM-supported services.

  • Dependent action: The dependent actions required to run the action. To complete the action, the RAM user or the RAM role must have the permissions to perform all dependent actions.

Action

Access level

Resource type

Condition key

Dependent action

fc:GetFunction

get

*All Resource

*

None None

Request syntax

GET /2021-04-06/services/{serviceName}/functions/{functionName} HTTP/1.1

Path Parameters

Parameter

Type

Required

Description

Example

serviceName

string

Yes

The name of the service.

service_name

functionName

string

Yes

The name of the function.

function_name

Request parameters

Parameter

Type

Required

Description

Example

qualifier

string

No

The version or alias of the service.

demoQualifier

X-Fc-Account-Id

string

No

The ID of your Alibaba Cloud account.

188077086902****

X-Fc-Date

string

No

The time on which the function is invoked. The format of the value is: EEE,d MMM yyyy HH:mm:ss GMT.

Wed, 11 May 2022 09:00:00 GMT

X-Fc-Trace-Id

string

No

The custom request ID.

asdf****

Response elements

Element

Type

Description

Example

object

The definition of the function.

codeChecksum

string

The CRC-64 value of the function code package.

2825179536350****

codeSize

integer

The size of the function code package. Unit: byte.

421

createdTime

string

The time when the function was created.

2020-04-01T08:15:27Z

description

string

The description of the function.

test_description

environmentVariables

object

The environment variables that are configured for the function. You can obtain the values of the environment variables from the function. For more information, see Environment variables.

string

The environment variables that you configured for the function.

{"key":"value"}

functionId

string

The ID that is generated by the system for the function. Each function ID is unique in Function Compute.

aa715851-1c20-4b89-a8fb-***

functionName

string

The name of the function.

function_name

handler

string

The handler of the function. For more information, see Function handler.

index.handler

lastModifiedTime

string

The time when the function was last modified.

2020-04-01T08:15:27Z

memorySize

integer

The memory size for the function. Unit: MB. The value must be a multiple of 64. The memory size varies based on the function instance type. For more information, see Instance types.

256

runtime

string

The runtime of the function. Valid values: nodejs20, nodejs18, nodejs16, nodejs14, nodejs12, nodejs10, nodejs8, nodejs6, nodejs4.4, python3.10, python3.9, python3, python2.7, java11, java8, go1, php7.2, dotnetcore2.1, custom.debian10, custom, and custom-container.

python3

timeout

integer

The timeout period for the execution of the function. Unit: seconds. Default value: 60. Valid values: 1 to 600. When this period expires, the execution of the function is terminated.

60

initializationTimeout

integer

The timeout period for the execution of the Initializer hook. Unit: seconds. Default value: 3. Valid values: 1 to 300. When this period ends, the execution of the Initializer hook is terminated.

60

initializer

string

The handler of the Initializer hook. The format of the value is determined by the programming language that you use. For more information, see Initializer hook.

index.handler

caPort

integer

The port on which the HTTP server listens for the custom runtime or custom container runtime.

9000

customContainerConfig CustomContainerConfigInfo

The configurations of the Custom Container runtime. After you configure the Custom Container runtime, you can use a custom container image to execute functions.

layers

array

The list of layers (ARN V1).

Note

If multiple layers exist, the layers are merged based on the array subscripts in descending order. The content of a layer with a smaller subscript overwrites that of a larger subscript.

Note

This parameter is to be deprecated. Use layersArnV2.

string

The name of the layer resource (ARN V1 version).

02f81d283888f5ec63442a88fe82b260#Layer-name#1

instanceConcurrency

integer

The number of requests that can be concurrently processed by a single instance.

10

instanceSoftConcurrency

integer

The soft concurrency of the instance. You can use this parameter to implement graceful scale-up of instances. If the number of concurrent requests on an instance is greater than the value of soft concurrency, an instance scale-up is triggered. For example, if your instance requires a long time to start, you can specify a suitable soft concurrency to start the instance in advance.

The value must be less than or equal to that of the instanceConcurrency parameter.

5

instanceType

string

The instance type of the function. Valid values:

  • e1: elastic instances

  • c1: performance instances

  • fc.gpu.tesla.1: GPU-accelerated instances with Tesla series cards

  • fc.gpu.ampere.1: GPU-accelerated instances with Ampere series cards

  • fc.gpu.ada.1:GPU-accelerated instances with Ada series cards

  • g1: same as fc.gpu.tesla.1

e1

instanceLifecycleConfig

InstanceLifecycleConfig

The lifecycle configurations of instances.

customDNS CustomDNS

The custom Domain Name System (DNS) settings of the function.

customRuntimeConfig CustomRuntimeConfig

The configurations of the function that runs in the custom runtime.

customHealthCheckConfig CustomHealthCheckConfig

The custom health check configurations of the function. This parameter is applicable only to custom runtimes and Custom Container runtimes.

layersArnV2

array

The list of layers (ARN V2).

Note

If multiple layers exist, the layers are merged based on the array subscripts in descending order. The content of a layer with a smaller subscript overwrites that of a larger subscript.

string

The name of the layer resource (ARN V2 version).

acs:fc:{region}:{accountID}:layers/{layerName}/versions/{layerVersion}

cpu

number

The number of vCPUs of the function. The value must be a multiple of 0.05.

1.5

diskSize

integer

The disk size of the function. Unit: MB. Valid values: 512 and 10240.

512

gpuMemorySize

integer

The GPU memory capacity for the function. Unit: MB. The value is a multiple of 1,024.

2048

Examples

Success response

JSON format

{
  "codeChecksum": "2825179536350****",
  "codeSize": 421,
  "createdTime": "2020-04-01T08:15:27Z",
  "description": "test_description",
  "environmentVariables": {
    "key": "{\"key\":\"value\"}"
  },
  "functionId": "aa715851-1c20-4b89-a8fb-***",
  "functionName": "function_name",
  "handler": "index.handler",
  "lastModifiedTime": "2020-04-01T08:15:27Z",
  "memorySize": 256,
  "runtime": "python3",
  "timeout": 60,
  "initializationTimeout": 60,
  "initializer": "index.handler",
  "caPort": 9000,
  "customContainerConfig": {
    "args": "[\"-arg1\", \"value1\"]",
    "command": "[\"/code/myserver\"]",
    "image": "registry-vpc.cn-hangzhou.aliyuncs.com/fc-demo/helloworld:v1beta1",
    "accelerationType": "Default",
    "accelerationInfo": {
      "status": "Preparing"
    },
    "instanceID": "cri-xxxxxxxxxx",
    "webServerMode": true
  },
  "layers": [
    "02f81d283888f5ec63442a88fe82b260#Layer-name#1"
  ],
  "instanceConcurrency": 10,
  "instanceSoftConcurrency": 5,
  "instanceType": "e1",
  "instanceLifecycleConfig": {
    "preFreeze": {
      "handler": "index.preStop",
      "timeout": 10
    },
    "preStop": {
      "handler": "index.preStop",
      "timeout": 10
    }
  },
  "customDNS": {
    "nameServers": [
      "8.8.x.x"
    ],
    "searches": [
      "ns1.svc.cluster-domain.example"
    ],
    "dnsOptions": [
      {
        "name": "ndots",
        "value": "2"
      }
    ]
  },
  "customRuntimeConfig": {
    "command": [
      "/code/myBootstrap"
    ],
    "args": [
      "args1"
    ]
  },
  "customHealthCheckConfig": {
    "httpGetUrl": "/ready",
    "initialDelaySeconds": 1,
    "periodSeconds": 1,
    "timeoutSeconds": 2,
    "failureThreshold": 1,
    "successThreshold": 2
  },
  "layersArnV2": [
    "acs:fc:{region}:{accountID}:layers/{layerName}/versions/{layerVersion}"
  ],
  "cpu": 1.5,
  "diskSize": 512,
  "gpuMemorySize": 2048
}

Error codes

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.