Systems Manager の機能であるオートメーションは、入力パラメーターに対して定義したリソースタイプに一致する AWS リソースを AWS Management Console に入力します。リソースタイプと一致する AWS アカウント のリソースがドロップダウンリストに表示され、選択できます。Amazon Elastic Compute Cloud (Amazon EC2) インスタンス、Amazon Simple Storage Service (Amazon S3) バケット、および AWS Identity and Access Management (IAM) ロールに対して、入力パラメータを定義できます。サポートされているタイプ定義と、一致するリソースを検索するために使用される正規表現は次のとおりです。
-
AWS::EC2::Instance::Id
-
^m?i-([a-z0-9]{8}|[a-z0-9]{17})$
-
List<AWS::EC2::Instance::Id>
-
^m?i-([a-z0-9]{8}|[a-z0-9]{17})$
-
AWS::S3::Bucket::Name
-
^[0-9a-z][a-z0-9\\-\\.]{3,63}$
-
List<AWS::S3::Bucket::Name>
-
^[0-9a-z][a-z0-9\\-\\.]{3,63}$
-
AWS::IAM::Role::Arn
-
^arn:(aws|aws-cn|aws-us-gov|aws-iso|aws-iso-b):iam::[0-9]{12}:role/.*$
-
List<AWS::IAM::Role::Arn>
-
^arn:(aws|aws-cn|aws-us-gov|aws-iso|aws-iso-b):iam::[0-9]{12}:role/.*$
以下は、ランブックコンテンツで定義される入力パラメータタイプの例です。
- YAML
-
description: Enables encryption on an Amazon S3 bucket
schemaVersion: '0.3'
assumeRole: '{{ AutomationAssumeRole }}'
parameters:
BucketName:
type: 'AWS::S3::Bucket::Name'
description: (Required) The name of the Amazon S3 bucket you want to encrypt.
SSEAlgorithm:
type: String
description: (Optional) The server-side encryption algorithm to use for the default encryption.
default: AES256
AutomationAssumeRole:
type: 'AWS::IAM::Role::Arn'
description: (Optional) The Amazon Resource Name (ARN) of the role that allows Automation to perform the actions on your behalf.
default: ''
mainSteps:
- name: enableBucketEncryption
action: 'aws:executeAwsApi'
inputs:
Service: s3
Api: PutBucketEncryption
Bucket: '{{BucketName}}'
ServerSideEncryptionConfiguration:
Rules:
- ApplyServerSideEncryptionByDefault:
SSEAlgorithm: '{{SSEAlgorithm}}'
isEnd: true
- JSON
-
{
"description": "Enables encryption on an Amazon S3 bucket",
"schemaVersion": "0.3",
"assumeRole": "{{ AutomationAssumeRole }}",
"parameters": {
"BucketName": {
"type": "AWS::S3::Bucket::Name",
"description": "(Required) The name of the Amazon S3 bucket you want to encrypt."
},
"SSEAlgorithm": {
"type": "String",
"description": "(Optional) The server-side encryption algorithm to use for the default encryption.",
"default": "AES256"
},
"AutomationAssumeRole": {
"type": "AWS::IAM::Role::Arn",
"description": "(Optional) The Amazon Resource Name (ARN) of the role that allows Automation to perform the actions on your behalf.",
"default": ""
}
},
"mainSteps": [
{
"name": "enableBucketEncryption",
"action": "aws:executeAwsApi",
"inputs": {
"Service": "s3",
"Api": "PutBucketEncryption",
"Bucket": "{{BucketName}}",
"ServerSideEncryptionConfiguration": {
"Rules": [
{
"ApplyServerSideEncryptionByDefault": {
"SSEAlgorithm": "{{SSEAlgorithm}}"
}
}
]
}
},
"isEnd": true
}
]
}