

# GetFunctionConfiguration
<a name="API_GetFunctionConfiguration"></a>

返回 Lambda 函数或版本的版本特定设置。输出仅包含在函数版本之间可能有所不同的选项。要修改这些设置，请使用 [UpdateFunctionConfiguration](API_UpdateFunctionConfiguration.md)。

要获取某个函数的所有详细信息，包括函数级别设置，请使用 [GetFunction](API_GetFunction.md)。

## 请求语法
<a name="API_GetFunctionConfiguration_RequestSyntax"></a>

```
GET /2015-03-31/functions/FunctionName/configuration?Qualifier=Qualifier HTTP/1.1
```

## URI 请求参数
<a name="API_GetFunctionConfiguration_RequestParameters"></a>

请求使用以下 URI 参数。

 ** [FunctionName](#API_GetFunctionConfiguration_RequestSyntax) **   <a name="lambda-GetFunctionConfiguration-request-FunctionName"></a>
Lambda 函数的名称、版本或别名。  

**名称格式**
+  **函数名称** – `my-function`（仅限名称）、`my-function:v1`（具有别名）。
+  **函数 ARN** – `arn:aws:lambda:us-west-2:123456789012:function:my-function`。
+  **部分 ARN** – `123456789012:function:my-function`。
您可以将一个版本号或别名附加到任何格式。长度约束仅适用于完整 ARN。如果您仅指定函数名称，它的长度限制为 64 个字符。  
长度限制：最小长度为 1。长度上限为 170。  
模式：`(arn:(aws[a-zA-Z-]*)?:lambda:)?([a-z]{2}(-gov)?-[a-z]+-\d{1}:)?(\d{12}:)?(function:)?([a-zA-Z0-9-_\.]+)(:(\$LATEST|[a-zA-Z0-9-_]+))?`  
必需：是

 ** [Qualifier](#API_GetFunctionConfiguration_RequestSyntax) **   <a name="lambda-GetFunctionConfiguration-request-Qualifier"></a>
指定版本或别名以获取有关函数发布版本的详细信息。  
长度限制：最小长度为 1。长度上限为 128。  
模式：`(|[a-zA-Z0-9$_-]+)`

## 请求正文
<a name="API_GetFunctionConfiguration_RequestBody"></a>

该请求没有请求正文。

## 响应语法
<a name="API_GetFunctionConfiguration_ResponseSyntax"></a>

```
HTTP/1.1 200
Content-type: application/json

{
   "Architectures": [ "string" ],
   "CodeSha256": "string",
   "CodeSize": number,
   "DeadLetterConfig": { 
      "TargetArn": "string"
   },
   "Description": "string",
   "Environment": { 
      "Error": { 
         "ErrorCode": "string",
         "Message": "string"
      },
      "Variables": { 
         "string" : "string" 
      }
   },
   "EphemeralStorage": { 
      "Size": number
   },
   "FileSystemConfigs": [ 
      { 
         "Arn": "string",
         "LocalMountPath": "string"
      }
   ],
   "FunctionArn": "string",
   "FunctionName": "string",
   "Handler": "string",
   "ImageConfigResponse": { 
      "Error": { 
         "ErrorCode": "string",
         "Message": "string"
      },
      "ImageConfig": { 
         "Command": [ "string" ],
         "EntryPoint": [ "string" ],
         "WorkingDirectory": "string"
      }
   },
   "KMSKeyArn": "string",
   "LastModified": "string",
   "LastUpdateStatus": "string",
   "LastUpdateStatusReason": "string",
   "LastUpdateStatusReasonCode": "string",
   "Layers": [ 
      { 
         "Arn": "string",
         "CodeSize": number,
         "SigningJobArn": "string",
         "SigningProfileVersionArn": "string"
      }
   ],
   "LoggingConfig": { 
      "ApplicationLogLevel": "string",
      "LogFormat": "string",
      "LogGroup": "string",
      "SystemLogLevel": "string"
   },
   "MasterArn": "string",
   "MemorySize": number,
   "PackageType": "string",
   "RevisionId": "string",
   "Role": "string",
   "Runtime": "string",
   "RuntimeVersionConfig": { 
      "Error": { 
         "ErrorCode": "string",
         "Message": "string"
      },
      "RuntimeVersionArn": "string"
   },
   "SigningJobArn": "string",
   "SigningProfileVersionArn": "string",
   "SnapStart": { 
      "ApplyOn": "string",
      "OptimizationStatus": "string"
   },
   "State": "string",
   "StateReason": "string",
   "StateReasonCode": "string",
   "Timeout": number,
   "TracingConfig": { 
      "Mode": "string"
   },
   "Version": "string",
   "VpcConfig": { 
      "Ipv6AllowedForDualStack": boolean,
      "SecurityGroupIds": [ "string" ],
      "SubnetIds": [ "string" ],
      "VpcId": "string"
   }
}
```

## 响应元素
<a name="API_GetFunctionConfiguration_ResponseElements"></a>

如果此操作成功，则该服务将会发送回 HTTP 200 响应。

服务以 JSON 格式返回以下数据。

 ** [Architectures](#API_GetFunctionConfiguration_ResponseSyntax) **   <a name="lambda-GetFunctionConfiguration-response-Architectures"></a>
该函数支持的指令集架构。架构是具有有效值之一的字符串数组。默认架构值是 `x86_64`。  
类型：字符串数组  
数组成员：固定数量为 1 项。  
有效值：`x86_64 | arm64`

 ** [CodeSha256](#API_GetFunctionConfiguration_ResponseSyntax) **   <a name="lambda-GetFunctionConfiguration-response-CodeSha256"></a>
函数部署包的 SHA256 哈希。  
类型：字符串

 ** [CodeSize](#API_GetFunctionConfiguration_ResponseSyntax) **   <a name="lambda-GetFunctionConfiguration-response-CodeSize"></a>
函数部署包的大小（以字节为单位）。  
类型：长整型

 ** [DeadLetterConfig](#API_GetFunctionConfiguration_ResponseSyntax) **   <a name="lambda-GetFunctionConfiguration-response-DeadLetterConfig"></a>
函数的死信队列。  
类型：[DeadLetterConfig](API_DeadLetterConfig.md) 对象

 ** [Description](#API_GetFunctionConfiguration_ResponseSyntax) **   <a name="lambda-GetFunctionConfiguration-response-Description"></a>
函数说明。  
类型：字符串  
长度约束：最小长度为 0。长度上限为 256。

 ** [Environment](#API_GetFunctionConfiguration_ResponseSyntax) **   <a name="lambda-GetFunctionConfiguration-response-Environment"></a>
函数[环境变量](https://docs.aws.amazon.com/lambda/latest/dg/configuration-envvars.html)。在 AWS CloudTrail 日志中被忽略。  
类型：[EnvironmentResponse](API_EnvironmentResponse.md) 对象

 ** [EphemeralStorage](#API_GetFunctionConfiguration_ResponseSyntax) **   <a name="lambda-GetFunctionConfiguration-response-EphemeralStorage"></a>
函数的 `/tmp` 目录大小（以 MB 为单位）。默认值为 512，但可以是介于 512 到 10240 MB 之间的任意整数。有关更多信息，请参阅[配置短暂存储（控制台）](https://docs.aws.amazon.com/lambda/latest/dg/configuration-function-common.html#configuration-ephemeral-storage)。  
类型：[EphemeralStorage](API_EphemeralStorage.md) 对象

 ** [FileSystemConfigs](#API_GetFunctionConfiguration_ResponseSyntax) **   <a name="lambda-GetFunctionConfiguration-response-FileSystemConfigs"></a>
[Amazon EFS 文件系统](https://docs.aws.amazon.com/lambda/latest/dg/configuration-filesystem.html)的连接设置。  
类型：[FileSystemConfig](API_FileSystemConfig.md) 对象数组  
数组成员：最多 1 个物品。

 ** [FunctionArn](#API_GetFunctionConfiguration_ResponseSyntax) **   <a name="lambda-GetFunctionConfiguration-response-FunctionArn"></a>
函数的 Amazon Resource Name (ARN)。  
类型：字符串  
模式：`arn:(aws[a-zA-Z-]*)?:lambda:[a-z]{2}(-gov)?-[a-z]+-\d{1}:\d{12}:function:[a-zA-Z0-9-_\.]+(:(\$LATEST|[a-zA-Z0-9-_]+))?`

 ** [FunctionName](#API_GetFunctionConfiguration_ResponseSyntax) **   <a name="lambda-GetFunctionConfiguration-response-FunctionName"></a>
函数的名称。  
类型：字符串  
长度限制：最小长度为 1。长度上限为 170。  
模式：`(arn:(aws[a-zA-Z-]*)?:lambda:)?([a-z]{2}(-gov)?-[a-z]+-\d{1}:)?(\d{12}:)?(function:)?([a-zA-Z0-9-_\.]+)(:(\$LATEST|[a-zA-Z0-9-_]+))?`

 ** [Handler](#API_GetFunctionConfiguration_ResponseSyntax) **   <a name="lambda-GetFunctionConfiguration-response-Handler"></a>
Lambda 为开始运行您的函数而调用的函数。  
类型：字符串  
长度限制：最大长度为 128。  
模式：`[^\s]+`

 ** [ImageConfigResponse](#API_GetFunctionConfiguration_ResponseSyntax) **   <a name="lambda-GetFunctionConfiguration-response-ImageConfigResponse"></a>
函数的镜像配置值。  
类型：[ImageConfigResponse](API_ImageConfigResponse.md) 对象

 ** [KMSKeyArn](#API_GetFunctionConfiguration_ResponseSyntax) **   <a name="lambda-GetFunctionConfiguration-response-KMSKeyArn"></a>
用于加密函数的[环境变量](https://docs.aws.amazon.com/lambda/latest/dg/configuration-envvars.html#configuration-envvars-encryption)的 AWS KMS key。激活 [Lambda SnapStart](https://docs.aws.amazon.com/lambda/latest/dg/snapstart-security.html) 时，此密钥还用于加密您的函数的快照。仅当您配置了客户托管密钥时，才会返回此密钥。  
类型：字符串  
模式：`(arn:(aws[a-zA-Z-]*)?:[a-z0-9-.]+:.*)|()`

 ** [LastModified](#API_GetFunctionConfiguration_ResponseSyntax) **   <a name="lambda-GetFunctionConfiguration-response-LastModified"></a>
该函数上次更新的日期和时间，采用 [ISO-8601 格式](https://www.w3.org/TR/NOTE-datetime) (YYYY-MM-DDThh:mm:ss.sTZD)。  
类型：字符串

 ** [LastUpdateStatus](#API_GetFunctionConfiguration_ResponseSyntax) **   <a name="lambda-GetFunctionConfiguration-response-LastUpdateStatus"></a>
上次对函数执行的更新的状态。函数创建完成后，首先设置为 `Successful`。  
类型：字符串  
有效值：`Successful | Failed | InProgress`

 ** [LastUpdateStatusReason](#API_GetFunctionConfiguration_ResponseSyntax) **   <a name="lambda-GetFunctionConfiguration-response-LastUpdateStatusReason"></a>
上次对函数执行更新的原因。  
类型：字符串

 ** [LastUpdateStatusReasonCode](#API_GetFunctionConfiguration_ResponseSyntax) **   <a name="lambda-GetFunctionConfiguration-response-LastUpdateStatusReasonCode"></a>
函数上次更新的原因代码。  
类型：字符串  
有效值：`EniLimitExceeded | InsufficientRolePermissions | InvalidConfiguration | InternalError | SubnetOutOfIPAddresses | InvalidSubnet | InvalidSecurityGroup | ImageDeleted | ImageAccessDenied | InvalidImage | KMSKeyAccessDenied | KMSKeyNotFound | InvalidStateKMSKey | DisabledKMSKey | EFSIOError | EFSMountConnectivityError | EFSMountFailure | EFSMountTimeout | InvalidRuntime | InvalidZipFileException | FunctionError`

 ** [Layers](#API_GetFunctionConfiguration_ResponseSyntax) **   <a name="lambda-GetFunctionConfiguration-response-Layers"></a>
函数的[层](https://docs.aws.amazon.com/lambda/latest/dg/configuration-layers.html)。  
类型：[Layer](API_Layer.md) 对象数组

 ** [LoggingConfig](#API_GetFunctionConfiguration_ResponseSyntax) **   <a name="lambda-GetFunctionConfiguration-response-LoggingConfig"></a>
该函数的 Amazon CloudWatch Logs 配置设置。  
类型：[LoggingConfig](API_LoggingConfig.md) 对象

 ** [MasterArn](#API_GetFunctionConfiguration_ResponseSyntax) **   <a name="lambda-GetFunctionConfiguration-response-MasterArn"></a>
对于 Lambda@Edge 函数，为主函数的 ARN。  
类型：字符串  
模式：`arn:(aws[a-zA-Z-]*)?:lambda:[a-z]{2}(-gov)?-[a-z]+-\d{1}:\d{12}:function:[a-zA-Z0-9-_]+(:(\$LATEST|[a-zA-Z0-9-_]+))?`

 ** [MemorySize](#API_GetFunctionConfiguration_ResponseSyntax) **   <a name="lambda-GetFunctionConfiguration-response-MemorySize"></a>
在运行时 可用于函数的内存 量。  
类型：整数  
有效范围：最小值为 128。最大值为 10240。

 ** [PackageType](#API_GetFunctionConfiguration_ResponseSyntax) **   <a name="lambda-GetFunctionConfiguration-response-PackageType"></a>
部署程序包的类型。将容器映像设置为 `Image`，然后将 .zip 文件存档设置为 `Zip`。  
类型：字符串  
有效值：`Zip | Image`

 ** [RevisionId](#API_GetFunctionConfiguration_ResponseSyntax) **   <a name="lambda-GetFunctionConfiguration-response-RevisionId"></a>
函数或别名的最新更新版本。  
类型：字符串

 ** [Role](#API_GetFunctionConfiguration_ResponseSyntax) **   <a name="lambda-GetFunctionConfiguration-response-Role"></a>
函数的执行角色。  
类型：字符串  
模式：`arn:(aws[a-zA-Z-]*)?:iam::\d{12}:role/?[a-zA-Z_0-9+=,.@\-_/]+`

 ** [Runtime](#API_GetFunctionConfiguration_ResponseSyntax) **   <a name="lambda-GetFunctionConfiguration-response-Runtime"></a>
函数的[运行时](https://docs.aws.amazon.com/lambda/latest/dg/lambda-runtimes.html)的标识符。如果部署包是 .zip 文件归档，则需要使用运行时。  
以下列表包括已弃用的运行时。有关更多信息，请参阅[运行时弃用策略](https://docs.aws.amazon.com/lambda/latest/dg/lambda-runtimes.html#runtime-support-policy)。  
类型：字符串  
有效值：`nodejs | nodejs4.3 | nodejs6.10 | nodejs8.10 | nodejs10.x | nodejs12.x | nodejs14.x | nodejs16.x | java8 | java8.al2 | java11 | python2.7 | python3.6 | python3.7 | python3.8 | python3.9 | dotnetcore1.0 | dotnetcore2.0 | dotnetcore2.1 | dotnetcore3.1 | dotnet6 | nodejs4.3-edge | go1.x | ruby2.5 | ruby2.7 | provided | provided.al2 | nodejs18.x | python3.10 | java17 | ruby3.2 | python3.11 | nodejs20.x | provided.al2023 | python3.12 | java21`

 ** [RuntimeVersionConfig](#API_GetFunctionConfiguration_ResponseSyntax) **   <a name="lambda-GetFunctionConfiguration-response-RuntimeVersionConfig"></a>
运行时的 ARN 和发生的任何错误。  
类型：[RuntimeVersionConfig](API_RuntimeVersionConfig.md) 对象

 ** [SigningJobArn](#API_GetFunctionConfiguration_ResponseSyntax) **   <a name="lambda-GetFunctionConfiguration-response-SigningJobArn"></a>
签名任务的 ARN。  
类型：字符串  
模式：`arn:(aws[a-zA-Z0-9-]*):([a-zA-Z0-9\-])+:([a-z]{2}(-gov)?-[a-z]+-\d{1})?:(\d{12})?:(.*)`

 ** [SigningProfileVersionArn](#API_GetFunctionConfiguration_ResponseSyntax) **   <a name="lambda-GetFunctionConfiguration-response-SigningProfileVersionArn"></a>
签名配置文件版本的 ARN。  
类型：字符串  
模式：`arn:(aws[a-zA-Z0-9-]*):([a-zA-Z0-9\-])+:([a-z]{2}(-gov)?-[a-z]+-\d{1})?:(\d{12})?:(.*)`

 ** [SnapStart](#API_GetFunctionConfiguration_ResponseSyntax) **   <a name="lambda-GetFunctionConfiguration-response-SnapStart"></a>
发布函数版本时，将 `ApplyOn` 设置为 `PublishedVersions` 以创建初始化执行环境的快照。有关更多信息，请参阅 [Improving startup performance with Lambda SnapStart](https://docs.aws.amazon.com/lambda/latest/dg/snapstart.html)（使用 Lambda SnapStart 提高启动性能）。  
类型：[SnapStartResponse](API_SnapStartResponse.md) 对象

 ** [State](#API_GetFunctionConfiguration_ResponseSyntax) **   <a name="lambda-GetFunctionConfiguration-response-State"></a>
函数的当前状态。当状态为 `Inactive`，您可以通过调用函数来重新激活该函数。  
类型：字符串  
有效值：`Pending | Active | Inactive | Failed`

 ** [StateReason](#API_GetFunctionConfiguration_ResponseSyntax) **   <a name="lambda-GetFunctionConfiguration-response-StateReason"></a>
函数当前状态的原因。  
类型：字符串

 ** [StateReasonCode](#API_GetFunctionConfiguration_ResponseSyntax) **   <a name="lambda-GetFunctionConfiguration-response-StateReasonCode"></a>
函数当前状态的原因代码。当代码为 `Creating` 时，无法调用或修改该函数。  
类型：字符串  
有效值：`Idle | Creating | Restoring | EniLimitExceeded | InsufficientRolePermissions | InvalidConfiguration | InternalError | SubnetOutOfIPAddresses | InvalidSubnet | InvalidSecurityGroup | ImageDeleted | ImageAccessDenied | InvalidImage | KMSKeyAccessDenied | KMSKeyNotFound | InvalidStateKMSKey | DisabledKMSKey | EFSIOError | EFSMountConnectivityError | EFSMountFailure | EFSMountTimeout | InvalidRuntime | InvalidZipFileException | FunctionError`

 ** [Timeout](#API_GetFunctionConfiguration_ResponseSyntax) **   <a name="lambda-GetFunctionConfiguration-response-Timeout"></a>
Lambda 在停止函数前允许其运行的时长（以秒为单位）。  
类型：整数  
有效范围：最小值为 1。

 ** [TracingConfig](#API_GetFunctionConfiguration_ResponseSyntax) **   <a name="lambda-GetFunctionConfiguration-response-TracingConfig"></a>
函数的 AWS X-Ray 跟踪配置。  
类型：[TracingConfigResponse](API_TracingConfigResponse.md) 对象

 ** [Version](#API_GetFunctionConfiguration_ResponseSyntax) **   <a name="lambda-GetFunctionConfiguration-response-Version"></a>
Lambda 函数的版本。  
类型：字符串  
长度限制：最小长度为 1。长度上限为 1024。  
模式：`(\$LATEST|[0-9]+)`

 ** [VpcConfig](#API_GetFunctionConfiguration_ResponseSyntax) **   <a name="lambda-GetFunctionConfiguration-response-VpcConfig"></a>
函数的网络配置。  
类型：[VpcConfigResponse](API_VpcConfigResponse.md) 对象

## 错误
<a name="API_GetFunctionConfiguration_Errors"></a>

有关所有操作返回的常见错误的信息，请参阅 [常见错误](CommonErrors.md)。

 ** InvalidParameterValueException **   
请求中的参数之一无效。  
HTTP 状态代码：400

 ** ResourceNotFoundException **   
请求中指定的资源不存在。  
HTTP 状态代码：404

 ** ServiceException **   
AWS Lambda 服务遇到了内部错误。  
HTTP 状态代码：500

 ** TooManyRequestsException **   
超出了请求吞吐量限制。有关更多信息，请参阅 [Lambda 限额](https://docs.aws.amazon.com/lambda/latest/dg/gettingstarted-limits.html#api-requests)。  
HTTP 状态代码：429

## 另请参阅
<a name="API_GetFunctionConfiguration_SeeAlso"></a>

有关在特定语言的 AWS SDK 中使用此 API 的更多信息，请参阅以下内容：
+  [AWS 命令行界面](https://docs.aws.amazon.com/goto/aws-cli/lambda-2015-03-31/GetFunctionConfiguration) 
+  [适用于 .NET 的 AWS SDK](https://docs.aws.amazon.com/goto/DotNetSDKV3/lambda-2015-03-31/GetFunctionConfiguration) 
+  [适用于 C\$1\$1 的 AWS SDK](https://docs.aws.amazon.com/goto/SdkForCpp/lambda-2015-03-31/GetFunctionConfiguration) 
+  [适用于 Go 的 AWS SDK](https://docs.aws.amazon.com/goto/SdkForGoV1/lambda-2015-03-31/GetFunctionConfiguration) 
+  [适用于 Java V2 的 AWS SDK](https://docs.aws.amazon.com/goto/SdkForJavaV2/lambda-2015-03-31/GetFunctionConfiguration) 
+  [AWS 适用于 JavaScript 的开发工具包 V3](https://docs.aws.amazon.com/goto/SdkForJavaScriptV3/lambda-2015-03-31/GetFunctionConfiguration) 
+  [适用于 PHP V3 的 AWS SDK](https://docs.aws.amazon.com/goto/SdkForPHPV3/lambda-2015-03-31/GetFunctionConfiguration) 
+  [适用于 Python 的 AWS SDK](https://docs.aws.amazon.com/goto/boto3/lambda-2015-03-31/GetFunctionConfiguration) 
+  [适用于 Ruby V3 的 AWS SDK](https://docs.aws.amazon.com/goto/SdkForRubyV3/lambda-2015-03-31/GetFunctionConfiguration) 