ALIYUN::FC::Function は、関数を作成する場合に使用します。 関数は、システムがスケジューリングや実行に使用するオブジェクトです。 関数はサービスに関連付ける必要があります。 サービスのすべての関数で、サービス許可やログ記録設定など、サービスのプロパティを共有します。

構文

  1. { Type”: ALIYUN::FC::Function”, Properties”: { Code”: Map, Description”: String, ServiceName”: String, MemorySize”: Integer, EnvironmentVariables”: Map, Handler”: String, Timeout”: Integer, Runtime”: String, FunctionName”: String }}

プロパティ

名前 データ型 必須/省略可能 更新可/不可 説明 制約
Code Map 必須 関数の実装を含むコード。 コードは、ZIP ファイルにパッケージ化されている必要があります。 なし
Description String 省略可能 関数の説明。 なし
ServiceName String 必須 不可 関数が属するサービスの名前。 名前は 1 から 128 文字にする必要があります。
MemorySize Integer 省略可能 関数のメモリサイズ。 単位:MB。 メモリサイズは 128 から 1536 の範囲です。 値は 64 単位で増やすことができます。
EnvironmentVariables Map 省略可能

関数用に設定された環境変数。 関数内で環境変数の値を取得できます。

なし
Handler String 必須

Function Compute で関数を実行するためのエントリポイント。 形式は、使用するプログラミング言語によって決まります。

なし
Timeout Integer 省略可能

関数実行のタイムアウト期間。 単位:秒。 デフォルト値 :3。 この期間を過ぎると、Function Compute は実行を終了します。

有効な値:1 から 300。
Runtime String 必須 関数のランタイム環境。 有効な値:nodejs6、nodejs8、python2.7、python3、および java8。
FunctionName String 必須 不可 関数の名前。 なし

Code 構文

  1. Code”: { OssBucketName”: String, OssObjectName”: String, ZipFile”: String}

Code プロパティ

名前 データ型 必須/省略可能 更新可/不可 説明 制約
OssBucketName String 省略可能 関数コードパッケージが保存されているバケットの名前。 なし
OssObjectName String 省略可能 関数コードパッケージが保存されているオブジェクトの名前。 なし
ZipFile String 省略可能 リクエスト本文にアップロードする Base64 エンコードの ZIP ファイル。 なし

レスポンスパラメーター

Fn::GetAtt

FunctionId:関数ごとに生成される一意の ID。

  1. { ROSTemplateFormatVersion”: 2015-09-01”, Resources”: { Function”: { Type”: ALIYUN::FC::Function”, Properties”: { Code”: { Ref”: Code }, Description”: { Ref”: Description }, ServiceName”: { Ref”: ServiceName }, MemorySize”: { Ref”: MemorySize }, EnvironmentVariables”: { Ref”: EnvironmentVariables }, Handler”: { Ref”: Handler }, Timeout”: { Ref”: Timeout }, Runtime”: { Ref”: Runtime }, FunctionName”: { Ref”: FunctionName } } } }, Parameters”: { Code”: { Type”: Json”, Description”: The code that contains the function implementation.” }, Description”: { Type”: String”, Description”: Function description }, ServiceName”: { MinLength”: 1, Type”: String”, Description”: Service name”, MaxLength”: 128 }, MemorySize”: { Default”: 128, Type”: Number”, Description”: The amount of memory that\u2019s used to run the function, in MB. Function Compute uses this value to allocate CPU resources proportionally. Defaults to 128 MB. It can be multiple of 64 MB and between 128 MB and 3072 MB .”, MaxValue”: 1536, MinValue”: 128 }, EnvironmentVariables”: { Type”: Json”, Description”: The environment variable set for the function, you can get the value of the environment variable in the function.” }, Handler”: { Type”: String”, Description”: The function execution entry point.” }, Timeout”: { Default”: 3, Type”: Number”, Description”: The maximum duration a function can run, in seconds. After which Function Compute terminates the execution. Defaults to 3 seconds, and can be between 1 to 300 seconds.”, MaxValue”: 300, MinValue”: 1 }, Runtime”: { Type”: String”, Description”: The function runtime environment. Supporting nodejs6, nodejs8, python2.7, python3, java8”, AllowedValues”: [ nodejs6”, nodejs8”, python2.7”, python3”, java8 ] }, FunctionName”: { Type”: String”, Description”: Function name } }, Outputs”: { FunctionId”: { Description”: The function ID”, Value”: { Fn::GetAtt”: [ Function”, FunctionId ] } } }}
  1. </article>
  2. </main>