AWS::SSM::Parameter
AWS::SSM::Parameter
リソースは、AWS Systems Managerパラメータストアで SSM パラメータを作成します。
SSM パラメータを作成するには、AWS Identity and Access Management (IAM) アクセス許可 ssm:PutParameter
および ssm:AddTagsToResource
が必要です。スタックの作成時に、指定する任意のカスタムタグに加え、AWS CloudFormation は次の 3 つのタグをパラメータに追加します: aws:cloudformation:stack-name
、aws:cloudformation:logical-id
、aws:cloudformation:stack-id
。
スタックの更新中にタグを追加、更新、削除するには、ssm:AddTagsToResource
および ssm:RemoveTagsFromResource
の両方の IAM アクセス許可が必要です。詳細については、AWS Systems Manager ユーザーガイドの「ポリシーを使用したアクセスの管理」を参照してください。
パラメータの有効な値の詳細については、AWS Systems Manager ユーザーガイドの「パラメータ名の要件と制約」および AWS Systems Manager API リファレンスの「PutParameter」を参照してください。
構文
AWS CloudFormation テンプレートでこのエンティティを宣言するには、次の構文を使用します。
JSON
{ "Type" : "AWS::SSM::Parameter", "Properties" : { "AllowedPattern" :
String
, "DataType" :String
, "Description" :String
, "Name" :String
, "Policies" :String
, "Tags" :Json
, "Tier" :String
, "Type" :String
, "Value" :String
} }
YAML
Type: AWS::SSM::Parameter Properties: AllowedPattern:
String
DataType:String
Description:String
Name:String
Policies:String
Tags:Json
Tier:String
Type:String
Value:String
プロパティ
AllowedPattern
-
パラメータ値を検証するために使用される正規表現。たとえば、数値に制限された値を持つ文字列型の場合、次のように指定できます。
AllowedPattern=^\d+$
必須: いいえ
タイプ: 文字列
最小:
0
最大:
1024
Update requires: No interruption
DataType
-
パラメータのデータ型 (
text
やaws:ec2:image
など)。デフォルト:text
。必須: いいえ
タイプ: 文字列
最小:
0
最大:
128
Update requires: No interruption
Description
-
パラメータに関する情報。
必須: いいえ
タイプ: 文字列
最小:
0
最大:
1024
Update requires: No interruption
Name
-
パラメータの名前。
必須: いいえ
タイプ: 文字列
最小:
1
最大:
2048
Update requires: Replacement
Policies
-
パラメータに割り当てられているポリシーに関する情報。
AWS Systems Manager ユーザーガイドの「パラメータポリシーの割り当て」
必須: いいえ
タイプ: 文字列
Update requires: No interruption
Tags
-
任意のタグセット (キーと値のペア) の形式でリソースに割り当てるオプションのメタデータ。タグを使用すると、目的、所有者、環境などのさまざまな方法でリソースを分類できます。たとえば、Systems Manager パラメータにタグを付けて、それが適用されるリソースのタイプ、環境、パラメータによって参照される設定データのタイプを識別できます。
必須: いいえ
タイプ: Json
最大:
1000
Update requires: No interruption
Tier
-
パラメータの階層。
必須: いいえ
タイプ: 文字列
許可された値:
Advanced | Intelligent-Tiering | Standard
Update requires: No interruption
Type
-
パラメータのタイプ。
注記 AWS CloudFormation は
SecureString
パラメータタイプの作成をサポートしていません。許可される値: 文字列 | StringList
必須: はい
タイプ: 文字列
Update requires: No interruption
Value
-
パラメータ値。
必須: はい
タイプ: 文字列
Update requires: No interruption
戻り値
参照番号
SSM パラメータの名前このリソースの論理 ID を組み込みの Ref
関数に渡すと、Ref
は次を返します: 。たとえば、ssm-myparameter-ABCNPH3XCAO6
と指定します。
For more information about using the Ref
function, see Ref.
Fn::GetAtt
Fn::GetAtt
組み込み関数は、このタイプの指定された属性の値を返します。以下には、利用可能な属性とサンプル戻り値のリストが示されます。
Fn::GetAtt
組み込み関数の使用方法の詳細については、「Fn::GetAtt」を参照してください。
例
文字列型のパラメータを作成する
次の例では、String
タイプを使用して、コマンドという名前の Systems Manager パラメータを作成し、タグのキーと値のペア "Environment":"Dev"
を追加します。
JSON
{ "Resources": { "BasicParameter": { "Type": "AWS::SSM::Parameter", "Properties": { "Name": "command", "Type": "String", "Value": "date", "Description": "SSM Parameter for running date command.", "AllowedPattern": "^[a-zA-Z]{1,10}$", "Tags": { "Environment": "DEV" } } } } }
YAML
--- Resources: BasicParameter: Type: AWS::SSM::Parameter Properties: Name: command Type: String Value: date Description: SSM Parameter for running date command. AllowedPattern: "^[a-zA-Z]{1,10}$" Tags: Environment: DEV
StringList 型のパラメータを作成する
次の例では、StringList
タイプの SSM パラメータを作成しています。
JSON
{ "Resources": { "BasicParameter": { "Type": "AWS::SSM::Parameter", "Properties": { "Name": "commands", "Type": "StringList", "Value": "date,ls", "Description": "SSM Parameter of type StringList.", "AllowedPattern": "^[a-zA-Z]{1,10}$" } } } }
YAML
--- Resources: BasicParameter: Type: AWS::SSM::Parameter Properties: Name: commands Type: StringList Value: date,ls Description: SSM Parameter of type StringList. AllowedPattern: "^[a-zA-Z]{1,10}$"
アドバンスト層パラメータを作成してポリシーを割り当てる
次の例では、String
タイプとパラメータポリシーを使用して、コマンドという名前の Systems Manager アドバンスト層パラメータを作成します。
JSON
{ "Resources": { "BasicParameter": { "Type": "AWS::SSM::Parameter", "Properties": { "Name": "command", "Type": "String", "Value": "date", "Tier": "Advanced", "Policies": "[{\"Type\":\"Expiration\",\"Version\":\"1.0\",\"Attributes\":{\"Timestamp\":\"2020-05-13T00:00:00.000Z\"}},{\"Type\":\"ExpirationNotification\",\"Version\":\"1.0\",\"Attributes\":{\"Before\":\"5\",\"Unit\":\"Days\"}},{\"Type\":\"NoChangeNotification\",\"Version\":\"1.0\",\"Attributes\":{\"After\":\"60\",\"Unit\":\"Days\"}}]", "Description": "SSM Parameter for running date command.", "AllowedPattern": "^[a-zA-Z]{1,10}$", "Tags": { "Environment": "DEV" } } } } }
YAML
--- Resources: BasicParameter: Type: AWS::SSM::Parameter Properties: Name: command Type: String Value: date Tier: Advanced Policies: '[{"Type":"Expiration","Version":"1.0","Attributes":{"Timestamp":"2020-05-13T00:00:00.000Z"}},{"Type":"ExpirationNotification","Version":"1.0","Attributes":{"Before":"5","Unit":"Days"}},{"Type":"NoChangeNotification","Version":"1.0","Attributes":{"After":"60","Unit":"Days"}}]' Description: SSM Parameter for running date command. AllowedPattern: "^[a-zA-Z]{1,10}$" Tags: Environment: DEV