Cookie の設定を選択する

当社は、当社のサイトおよびサービスを提供するために必要な必須 Cookie および類似のツールを使用しています。当社は、パフォーマンス Cookie を使用して匿名の統計情報を収集することで、お客様が当社のサイトをどのように利用しているかを把握し、改善に役立てています。必須 Cookie は無効化できませんが、[カスタマイズ] または [拒否] をクリックしてパフォーマンス Cookie を拒否することはできます。

お客様が同意した場合、AWS および承認された第三者は、Cookie を使用して便利なサイト機能を提供したり、お客様の選択を記憶したり、関連する広告を含む関連コンテンツを表示したりします。すべての必須ではない Cookie を受け入れるか拒否するには、[受け入れる] または [拒否] をクリックしてください。より詳細な選択を行うには、[カスタマイズ] をクリックしてください。

AWS OpsWorks CM examples using AWS CLI

フォーカスモード
AWS OpsWorks CM examples using AWS CLI - AWS Command Line Interface

このドキュメントはバージョン 1 の AWS CLI のみを対象としています。AWS CLI のバージョン 2 に関連するドキュメントについては、バージョン 2 用ユーザーガイドを参照してください。

このドキュメントはバージョン 1 の AWS CLI のみを対象としています。AWS CLI のバージョン 2 に関連するドキュメントについては、バージョン 2 用ユーザーガイドを参照してください。

次のコード例では、AWS OpsWorks CM で AWS Command Line Interface を使用してアクションを実行し、一般的なシナリオを実装する方法を示しています。

アクションはより大きなプログラムからのコードの抜粋であり、コンテキスト内で実行する必要があります。アクションは個々のサービス機能を呼び出す方法を示していますが、コンテキスト内のアクションは、関連するシナリオで確認できます。

各例には完全なソースコードへのリンクが含まれており、コードの設定方法と実行方法に関する手順を確認できます。

トピック

アクション

次の例は、associate-node を使用する方法を説明しています。

AWS CLI

ノードを関連付けるには

次の associate-node コマンドは、automate-06 という名前の Chef Automate サーバーに、i-44de882p という名前のノードを関連付けます。つまり、automate-06 サーバーはノードを管理し、associate-node コマンドによってノードにインストールされた chef-client エージェントソフトウェアを介してレシピコマンドをノードに伝えます。有効なノード名は EC2 インスタンス ID です。

aws opsworks-cm associate-node --server-name "automate-06" --node-name "i-43de882p" --engine-attributes "Name=CHEF_ORGANIZATION,Value='MyOrganization' Name=CHEF_NODE_PUBLIC_KEY,Value='Public_key_contents'"

コマンドによって返される出力は次のようになります。出力:

{ "NodeAssociationStatusToken": "AHUY8wFe4pdXtZC5DiJa5SOLp5o14DH//rHRqHDWXxwVoNBxcEy4V7R0NOFymh7E/1HumOBPsemPQFE6dcGaiFk" }

詳細情報

詳細については、「AWS OpsWorks User Guide」の「Adding Nodes Automatically in AWS OpsWorks for Chef Automate」を参照してください。

  • API の詳細については、「AWS CLI コマンドリファレンス」の「AssociateNode」を参照してください。

次の例は、associate-node を使用する方法を説明しています。

AWS CLI

ノードを関連付けるには

次の associate-node コマンドは、automate-06 という名前の Chef Automate サーバーに、i-44de882p という名前のノードを関連付けます。つまり、automate-06 サーバーはノードを管理し、associate-node コマンドによってノードにインストールされた chef-client エージェントソフトウェアを介してレシピコマンドをノードに伝えます。有効なノード名は EC2 インスタンス ID です。

aws opsworks-cm associate-node --server-name "automate-06" --node-name "i-43de882p" --engine-attributes "Name=CHEF_ORGANIZATION,Value='MyOrganization' Name=CHEF_NODE_PUBLIC_KEY,Value='Public_key_contents'"

コマンドによって返される出力は次のようになります。出力:

{ "NodeAssociationStatusToken": "AHUY8wFe4pdXtZC5DiJa5SOLp5o14DH//rHRqHDWXxwVoNBxcEy4V7R0NOFymh7E/1HumOBPsemPQFE6dcGaiFk" }

詳細情報

詳細については、「AWS OpsWorks User Guide」の「Adding Nodes Automatically in AWS OpsWorks for Chef Automate」を参照してください。

  • API の詳細については、「AWS CLI コマンドリファレンス」の「AssociateNode」を参照してください。

次のコード例は、create-backup を使用する方法を示しています。

AWS CLI

バックアップを作成するには

次の create-backup コマンドは、us-east-1 リージョンの automate-06 という名前の Chef Automate サーバーの手動バックアップを開始します。このコマンドは、--description パラメータのバックアップに説明メッセージを追加します。

aws opsworks-cm create-backup \ --server-name 'automate-06' \ --description "state of my infrastructure at launch"

出力には、新しいバックアップに関する次のような情報が表示されます。

出力:

{ "Backups": [ { "BackupArn": "string", "BackupId": "automate-06-20160729133847520", "BackupType": "MANUAL", "CreatedAt": 2016-07-29T13:38:47.520Z, "Description": "state of my infrastructure at launch", "Engine": "Chef", "EngineModel": "Single", "EngineVersion": "12", "InstanceProfileArn": "arn:aws:iam::1019881987024:instance-profile/automate-06-1010V4UU2WRM2", "InstanceType": "m4.large", "KeyPair": "", "PreferredBackupWindow": "", "PreferredMaintenanceWindow": "", "S3LogUrl": "https://s3.amazonaws.com/<bucket-name>/automate-06-20160729133847520", "SecurityGroupIds": [ "sg-1a24c270" ], "ServerName": "automate-06", "ServiceRoleArn": "arn:aws:iam::1019881987024:role/aws-opsworks-cm-service-role.1114810729735", "Status": "OK", "StatusDescription": "", "SubnetIds": [ "subnet-49436a18" ], "ToolsVersion": "string", "UserArn": "arn:aws:iam::1019881987024:user/opsworks-user" } ], }

詳細については、「AWS OpsWorks User Guide」の「Back Up and Restore an AWS OpsWorks for Chef Automate Server」を参照してください。

  • API の詳細については、「AWS CLI コマンドリファレンス」の「CreateBackup」を参照してください。

次のコード例は、create-backup を使用する方法を示しています。

AWS CLI

バックアップを作成するには

次の create-backup コマンドは、us-east-1 リージョンの automate-06 という名前の Chef Automate サーバーの手動バックアップを開始します。このコマンドは、--description パラメータのバックアップに説明メッセージを追加します。

aws opsworks-cm create-backup \ --server-name 'automate-06' \ --description "state of my infrastructure at launch"

出力には、新しいバックアップに関する次のような情報が表示されます。

出力:

{ "Backups": [ { "BackupArn": "string", "BackupId": "automate-06-20160729133847520", "BackupType": "MANUAL", "CreatedAt": 2016-07-29T13:38:47.520Z, "Description": "state of my infrastructure at launch", "Engine": "Chef", "EngineModel": "Single", "EngineVersion": "12", "InstanceProfileArn": "arn:aws:iam::1019881987024:instance-profile/automate-06-1010V4UU2WRM2", "InstanceType": "m4.large", "KeyPair": "", "PreferredBackupWindow": "", "PreferredMaintenanceWindow": "", "S3LogUrl": "https://s3.amazonaws.com/<bucket-name>/automate-06-20160729133847520", "SecurityGroupIds": [ "sg-1a24c270" ], "ServerName": "automate-06", "ServiceRoleArn": "arn:aws:iam::1019881987024:role/aws-opsworks-cm-service-role.1114810729735", "Status": "OK", "StatusDescription": "", "SubnetIds": [ "subnet-49436a18" ], "ToolsVersion": "string", "UserArn": "arn:aws:iam::1019881987024:user/opsworks-user" } ], }

詳細については、「AWS OpsWorks User Guide」の「Back Up and Restore an AWS OpsWorks for Chef Automate Server」を参照してください。

  • API の詳細については、「AWS CLI コマンドリファレンス」の「CreateBackup」を参照してください。

次のコード例は、create-server を使用する方法を示しています。

AWS CLI

サーバーを作成するには

次の create-server の例では、デフォルトのリージョンに automate-06 という名前の新しい Chef Automate サーバーを作成します。デフォルト値は、保持するバックアップの数、メンテナンスとバックアップの開始時間など、他のほとんどの設定で使用されます。create-server コマンドを実行する前に、「AWS OpsWorks for Chef Automate User Guide」の「Getting Started with AWS OpsWorks for Chef Automate」の前提条件を満たしてください。

aws opsworks-cm create-server \ --engine "Chef" \ --engine-model "Single" \ --engine-version "12" \ --server-name "automate-06" \ --instance-profile-arn "arn:aws:iam::1019881987024:instance-profile/aws-opsworks-cm-ec2-role" \ --instance-type "t2.medium" \ --key-pair "amazon-test" \ --service-role-arn "arn:aws:iam::044726508045:role/aws-opsworks-cm-service-role"

出力には、新しいサーバーに関する次のような情報が表示されます。

{ "Server": { "BackupRetentionCount": 10, "CreatedAt": 2016-07-29T13:38:47.520Z, "DisableAutomatedBackup": FALSE, "Endpoint": "https://opsworks-cm.us-east-1.amazonaws.com", "Engine": "Chef", "EngineAttributes": [ { "Name": "CHEF_DELIVERY_ADMIN_PASSWORD", "Value": "1Password1" } ], "EngineModel": "Single", "EngineVersion": "12", "InstanceProfileArn": "arn:aws:iam::1019881987024:instance-profile/aws-opsworks-cm-ec2-role", "InstanceType": "t2.medium", "KeyPair": "amazon-test", "MaintenanceStatus": "", "PreferredBackupWindow": "Sun:02:00", "PreferredMaintenanceWindow": "00:00", "SecurityGroupIds": [ "sg-1a24c270" ], "ServerArn": "arn:aws:iam::1019881987024:instance/automate-06-1010V4UU2WRM2", "ServerName": "automate-06", "ServiceRoleArn": "arn:aws:iam::1019881987024:role/aws-opsworks-cm-service-role", "Status": "CREATING", "StatusReason": "", "SubnetIds": [ "subnet-49436a18" ] } }

詳細については、「AWS OpsWorks for Chef Automate API Reference」の「UpdateServer」を参照してください。

  • API の詳細については、「AWS CLI コマンドリファレンス」の「CreateServer」を参照してください。

次のコード例は、create-server を使用する方法を示しています。

AWS CLI

サーバーを作成するには

次の create-server の例では、デフォルトのリージョンに automate-06 という名前の新しい Chef Automate サーバーを作成します。デフォルト値は、保持するバックアップの数、メンテナンスとバックアップの開始時間など、他のほとんどの設定で使用されます。create-server コマンドを実行する前に、「AWS OpsWorks for Chef Automate User Guide」の「Getting Started with AWS OpsWorks for Chef Automate」の前提条件を満たしてください。

aws opsworks-cm create-server \ --engine "Chef" \ --engine-model "Single" \ --engine-version "12" \ --server-name "automate-06" \ --instance-profile-arn "arn:aws:iam::1019881987024:instance-profile/aws-opsworks-cm-ec2-role" \ --instance-type "t2.medium" \ --key-pair "amazon-test" \ --service-role-arn "arn:aws:iam::044726508045:role/aws-opsworks-cm-service-role"

出力には、新しいサーバーに関する次のような情報が表示されます。

{ "Server": { "BackupRetentionCount": 10, "CreatedAt": 2016-07-29T13:38:47.520Z, "DisableAutomatedBackup": FALSE, "Endpoint": "https://opsworks-cm.us-east-1.amazonaws.com", "Engine": "Chef", "EngineAttributes": [ { "Name": "CHEF_DELIVERY_ADMIN_PASSWORD", "Value": "1Password1" } ], "EngineModel": "Single", "EngineVersion": "12", "InstanceProfileArn": "arn:aws:iam::1019881987024:instance-profile/aws-opsworks-cm-ec2-role", "InstanceType": "t2.medium", "KeyPair": "amazon-test", "MaintenanceStatus": "", "PreferredBackupWindow": "Sun:02:00", "PreferredMaintenanceWindow": "00:00", "SecurityGroupIds": [ "sg-1a24c270" ], "ServerArn": "arn:aws:iam::1019881987024:instance/automate-06-1010V4UU2WRM2", "ServerName": "automate-06", "ServiceRoleArn": "arn:aws:iam::1019881987024:role/aws-opsworks-cm-service-role", "Status": "CREATING", "StatusReason": "", "SubnetIds": [ "subnet-49436a18" ] } }

詳細については、「AWS OpsWorks for Chef Automate API Reference」の「UpdateServer」を参照してください。

  • API の詳細については、「AWS CLI コマンドリファレンス」の「CreateServer」を参照してください。

次の例は、delete-backup を使用する方法を説明しています。

AWS CLI

バックアップを削除するには

次の delete-backup コマンドは、バックアップ ID で識別される Chef Automate サーバーの手動または自動バックアップを削除します。このコマンドは、保存できるバックアップの最大数に近づいている場合や、Amazon S3 ストレージコストを最小限に抑えたい場合に便利です。

aws opsworks-cm delete-backup --backup-id "automate-06-2016-11-19T23:42:40.240Z"

出力は、バックアップの削除が成功したかどうかを示します。

詳細情報

詳細については、「AWS OpsWorks User Guide」の「Back Up and Restore an AWS OpsWorks for Chef Automate Server」を参照してください。

  • API の詳細については、「AWS CLI コマンドリファレンス」の「DeleteBackup」を参照してください。

次の例は、delete-backup を使用する方法を説明しています。

AWS CLI

バックアップを削除するには

次の delete-backup コマンドは、バックアップ ID で識別される Chef Automate サーバーの手動または自動バックアップを削除します。このコマンドは、保存できるバックアップの最大数に近づいている場合や、Amazon S3 ストレージコストを最小限に抑えたい場合に便利です。

aws opsworks-cm delete-backup --backup-id "automate-06-2016-11-19T23:42:40.240Z"

出力は、バックアップの削除が成功したかどうかを示します。

詳細情報

詳細については、「AWS OpsWorks User Guide」の「Back Up and Restore an AWS OpsWorks for Chef Automate Server」を参照してください。

  • API の詳細については、「AWS CLI コマンドリファレンス」の「DeleteBackup」を参照してください。

次のコード例は、delete-server を使用する方法を示しています。

AWS CLI

サーバーを削除するには

次の delete-server コマンドは、サーバー名で識別される Chef Automate サーバーを削除します。サーバーが削除されると、DescribeServer リクエストによって返されなくなります。

aws opsworks-cm delete-server --server-name "automate-06"

出力は、サーバーの削除が成功したかどうかを示します。

詳細情報

詳細については、「AWS OpsWorks User Guide」の「Delete an AWS OpsWorks for Chef Automate Server」を参照してください。

  • API の詳細については、「AWS CLI コマンドリファレンス」の「DeleteServer」を参照してください。

次のコード例は、delete-server を使用する方法を示しています。

AWS CLI

サーバーを削除するには

次の delete-server コマンドは、サーバー名で識別される Chef Automate サーバーを削除します。サーバーが削除されると、DescribeServer リクエストによって返されなくなります。

aws opsworks-cm delete-server --server-name "automate-06"

出力は、サーバーの削除が成功したかどうかを示します。

詳細情報

詳細については、「AWS OpsWorks User Guide」の「Delete an AWS OpsWorks for Chef Automate Server」を参照してください。

  • API の詳細については、「AWS CLI コマンドリファレンス」の「DeleteServer」を参照してください。

次の例は、describe-account-attributes を使用する方法を説明しています。

AWS CLI

アカウントの属性を記述するには

次の describe-account-attributes コマンドは、アカウントによる AWS OpsWorks for Chef Automate リソースの使用に関する情報を返します。

aws opsworks-cm describe-account-attributes

コマンドによって返される各アカウントの属性エントリの出力は次のようになります。出力:

{ "Attributes": [ { "Maximum": 5, "Name": "ServerLimit", "Used": 2 } ] }

詳細情報

詳細については、「AWS OpsWorks for Chef Automate API Reference」の「DescribeAccountAttributes」を参照してください。

  • API の詳細については、「AWS CLI コマンドリファレンス」の「DescribeAccountAttributes」を参照してください。

次の例は、describe-account-attributes を使用する方法を説明しています。

AWS CLI

アカウントの属性を記述するには

次の describe-account-attributes コマンドは、アカウントによる AWS OpsWorks for Chef Automate リソースの使用に関する情報を返します。

aws opsworks-cm describe-account-attributes

コマンドによって返される各アカウントの属性エントリの出力は次のようになります。出力:

{ "Attributes": [ { "Maximum": 5, "Name": "ServerLimit", "Used": 2 } ] }

詳細情報

詳細については、「AWS OpsWorks for Chef Automate API Reference」の「DescribeAccountAttributes」を参照してください。

  • API の詳細については、「AWS CLI コマンドリファレンス」の「DescribeAccountAttributes」を参照してください。

次のコード例は、describe-backups を使用する方法を示しています。

AWS CLI

バックアップについて説明するには

次の describe-backups コマンドは、デフォルトリージョンのアカウントに関連付けられているすべてのバックアップに関する情報を返します。

aws opsworks-cm describe-backups

コマンドによって返される各バックアップエントリの出力は次のようになります。

出力:

{ "Backups": [ { "BackupArn": "string", "BackupId": "automate-06-20160729133847520", "BackupType": "MANUAL", "CreatedAt": 2016-07-29T13:38:47.520Z, "Description": "state of my infrastructure at launch", "Engine": "Chef", "EngineModel": "Single", "EngineVersion": "12", "InstanceProfileArn": "arn:aws:iam::1019881987024:instance-profile/automate-06-1010V4UU2WRM2", "InstanceType": "m4.large", "KeyPair": "", "PreferredBackupWindow": "", "PreferredMaintenanceWindow": "", "S3LogUrl": "https://s3.amazonaws.com/<bucket-name>/automate-06-20160729133847520", "SecurityGroupIds": [ "sg-1a24c270" ], "ServerName": "automate-06", "ServiceRoleArn": "arn:aws:iam::1019881987024:role/aws-opsworks-cm-service-role.1114810729735", "Status": "Successful", "StatusDescription": "", "SubnetIds": [ "subnet-49436a18" ], "ToolsVersion": "string", "UserArn": "arn:aws:iam::1019881987024:user/opsworks-user" } ], }

詳細については、「AWS OpsWorks User Guide」の「Back Up and Restore an AWS OpsWorks for Chef Automate Server」を参照してください。

  • API の詳細については、「AWS CLI コマンドリファレンス」の「DescribeBackups」を参照してください。

次のコード例は、describe-backups を使用する方法を示しています。

AWS CLI

バックアップについて説明するには

次の describe-backups コマンドは、デフォルトリージョンのアカウントに関連付けられているすべてのバックアップに関する情報を返します。

aws opsworks-cm describe-backups

コマンドによって返される各バックアップエントリの出力は次のようになります。

出力:

{ "Backups": [ { "BackupArn": "string", "BackupId": "automate-06-20160729133847520", "BackupType": "MANUAL", "CreatedAt": 2016-07-29T13:38:47.520Z, "Description": "state of my infrastructure at launch", "Engine": "Chef", "EngineModel": "Single", "EngineVersion": "12", "InstanceProfileArn": "arn:aws:iam::1019881987024:instance-profile/automate-06-1010V4UU2WRM2", "InstanceType": "m4.large", "KeyPair": "", "PreferredBackupWindow": "", "PreferredMaintenanceWindow": "", "S3LogUrl": "https://s3.amazonaws.com/<bucket-name>/automate-06-20160729133847520", "SecurityGroupIds": [ "sg-1a24c270" ], "ServerName": "automate-06", "ServiceRoleArn": "arn:aws:iam::1019881987024:role/aws-opsworks-cm-service-role.1114810729735", "Status": "Successful", "StatusDescription": "", "SubnetIds": [ "subnet-49436a18" ], "ToolsVersion": "string", "UserArn": "arn:aws:iam::1019881987024:user/opsworks-user" } ], }

詳細については、「AWS OpsWorks User Guide」の「Back Up and Restore an AWS OpsWorks for Chef Automate Server」を参照してください。

  • API の詳細については、「AWS CLI コマンドリファレンス」の「DescribeBackups」を参照してください。

次の例は、describe-events を使用する方法を説明しています。

AWS CLI

イベントについて説明するには

次の describe-events の例では、指定された Chef Automate サーバーに関連付けられているすべてのイベントに関する情報を返します。

aws opsworks-cm describe-events \ --server-name 'automate-06'

コマンドによって返される各イベントエントリの出力は、次の例のようになります。

{ "ServerEvents": [ { "CreatedAt": 2016-07-29T13:38:47.520Z, "LogUrl": "https://s3.amazonaws.com/<bucket-name>/automate-06-20160729133847520", "Message": "Updates successfully installed.", "ServerName": "automate-06" } ] }

詳細については、「AWS OpsWorks User Guide」の「General Troubleshooting Tips」を参照してください。

  • API の詳細については、「AWS CLI コマンドリファレンス」の「DescribeEvents」を参照してください。

次の例は、describe-events を使用する方法を説明しています。

AWS CLI

イベントについて説明するには

次の describe-events の例では、指定された Chef Automate サーバーに関連付けられているすべてのイベントに関する情報を返します。

aws opsworks-cm describe-events \ --server-name 'automate-06'

コマンドによって返される各イベントエントリの出力は、次の例のようになります。

{ "ServerEvents": [ { "CreatedAt": 2016-07-29T13:38:47.520Z, "LogUrl": "https://s3.amazonaws.com/<bucket-name>/automate-06-20160729133847520", "Message": "Updates successfully installed.", "ServerName": "automate-06" } ] }

詳細については、「AWS OpsWorks User Guide」の「General Troubleshooting Tips」を参照してください。

  • API の詳細については、「AWS CLI コマンドリファレンス」の「DescribeEvents」を参照してください。

次の例は、describe-node-association-status を使用する方法を説明しています。

AWS CLI

ノードの関連付けステータスについて説明するには

次の describe-node-association-status コマンドは、ノードを automate-06 という名前の Chef Automate サーバーに関連付けるリクエストのステータスを返します。

aws opsworks-cm describe-node-association-status --server-name "automate-06" --node-association-status-token "AflJKl+/GoKLZJBdDQEx0O65CDi57blQe9nKM8joSok0pQ9xr8DqApBN9/1O6sLdSvlfDEKkEx+eoCHvjoWHaOs="

コマンドによって返される各アカウントの属性エントリの出力は次のようになります。出力:

{ "NodeAssociationStatus": "IN_PROGRESS" }

詳細情報

詳細については、「AWS OpsWorks for Chef Automate API Reference」の「DescribeNodeAssociationStatus」を参照してください。

  • API の詳細については、「AWS CLI コマンドリファレンス」の「DescribeNodeAssociationStatus」を参照してください。

次の例は、describe-node-association-status を使用する方法を説明しています。

AWS CLI

ノードの関連付けステータスについて説明するには

次の describe-node-association-status コマンドは、ノードを automate-06 という名前の Chef Automate サーバーに関連付けるリクエストのステータスを返します。

aws opsworks-cm describe-node-association-status --server-name "automate-06" --node-association-status-token "AflJKl+/GoKLZJBdDQEx0O65CDi57blQe9nKM8joSok0pQ9xr8DqApBN9/1O6sLdSvlfDEKkEx+eoCHvjoWHaOs="

コマンドによって返される各アカウントの属性エントリの出力は次のようになります。出力:

{ "NodeAssociationStatus": "IN_PROGRESS" }

詳細情報

詳細については、「AWS OpsWorks for Chef Automate API Reference」の「DescribeNodeAssociationStatus」を参照してください。

  • API の詳細については、「AWS CLI コマンドリファレンス」の「DescribeNodeAssociationStatus」を参照してください。

次のコード例は、describe-servers を使用する方法を示しています。

AWS CLI

サーバーについて説明するには

次の describe-servers コマンドは、デフォルトのリージョンにあり、アカウントに関連付けられているすべてのサーバーに関する情報を返します。

aws opsworks-cm describe-servers

コマンドによって返される各サーバーエントリの出力は次のようになります。出力:

{ "Servers": [ { "BackupRetentionCount": 8, "CreatedAt": 2016-07-29T13:38:47.520Z, "DisableAutomatedBackup": FALSE, "Endpoint": "https://opsworks-cm.us-east-1.amazonaws.com", "Engine": "Chef", "EngineAttributes": [ { "Name": "CHEF_DELIVERY_ADMIN_PASSWORD", "Value": "1Password1" } ], "EngineModel": "Single", "EngineVersion": "12", "InstanceProfileArn": "arn:aws:iam::1019881987024:instance-profile/automate-06-1010V4UU2WRM2", "InstanceType": "m4.large", "KeyPair": "", "MaintenanceStatus": "SUCCESS", "PreferredBackupWindow": "03:00", "PreferredMaintenanceWindow": "Mon:09:00", "SecurityGroupIds": [ "sg-1a24c270" ], "ServerArn": "arn:aws:iam::1019881987024:instance/automate-06-1010V4UU2WRM2", "ServerName": "automate-06", "ServiceRoleArn": "arn:aws:iam::1019881987024:role/aws-opsworks-cm-service-role.1114810729735", "Status": "HEALTHY", "StatusReason": "", "SubnetIds": [ "subnet-49436a18" ] } ] }

詳細情報

詳細については、「AWS OpsWorks for Chef Automate API Guide」の「DescribeServers」を参照してください。

  • API の詳細については、「AWS CLI コマンドリファレンス」の「DescribeServers」を参照してください。

次のコード例は、describe-servers を使用する方法を示しています。

AWS CLI

サーバーについて説明するには

次の describe-servers コマンドは、デフォルトのリージョンにあり、アカウントに関連付けられているすべてのサーバーに関する情報を返します。

aws opsworks-cm describe-servers

コマンドによって返される各サーバーエントリの出力は次のようになります。出力:

{ "Servers": [ { "BackupRetentionCount": 8, "CreatedAt": 2016-07-29T13:38:47.520Z, "DisableAutomatedBackup": FALSE, "Endpoint": "https://opsworks-cm.us-east-1.amazonaws.com", "Engine": "Chef", "EngineAttributes": [ { "Name": "CHEF_DELIVERY_ADMIN_PASSWORD", "Value": "1Password1" } ], "EngineModel": "Single", "EngineVersion": "12", "InstanceProfileArn": "arn:aws:iam::1019881987024:instance-profile/automate-06-1010V4UU2WRM2", "InstanceType": "m4.large", "KeyPair": "", "MaintenanceStatus": "SUCCESS", "PreferredBackupWindow": "03:00", "PreferredMaintenanceWindow": "Mon:09:00", "SecurityGroupIds": [ "sg-1a24c270" ], "ServerArn": "arn:aws:iam::1019881987024:instance/automate-06-1010V4UU2WRM2", "ServerName": "automate-06", "ServiceRoleArn": "arn:aws:iam::1019881987024:role/aws-opsworks-cm-service-role.1114810729735", "Status": "HEALTHY", "StatusReason": "", "SubnetIds": [ "subnet-49436a18" ] } ] }

詳細情報

詳細については、「AWS OpsWorks for Chef Automate API Guide」の「DescribeServers」を参照してください。

  • API の詳細については、「AWS CLI コマンドリファレンス」の「DescribeServers」を参照してください。

次のコード例は、disassociate-node を使用する方法を示しています。

AWS CLI

ノードの関連付けを解除するには

次の disassociate-node コマンドは、i-44de882p という名前のノードの関連付けを解除し、automate-06 という名前の Chef Automate サーバーによる管理からノードを削除します。有効なノード名は EC2 インスタンス ID です。

aws opsworks-cm disassociate-node --server-name "automate-06" --node-name "i-43de882p" --engine-attributes "Name=CHEF_ORGANIZATION,Value='MyOrganization' Name=CHEF_NODE_PUBLIC_KEY,Value='Public_key_contents'"

コマンドによって返される出力は次のようになります。出力:

{ "NodeAssociationStatusToken": "AHUY8wFe4pdXtZC5DiJa5SOLp5o14DH//rHRqHDWXxwVoNBxcEy4V7R0NOFymh7E/1HumOBPsemPQFE6dcGaiFk" }

詳細情報

詳細については、「AWS OpsWorks User Guide」の「Delete an AWS OpsWorks for Chef Automate Server」を参照してください。

  • API の詳細については、「AWS CLI コマンドリファレンス」の「DisassociateNode」を参照してください。

次のコード例は、disassociate-node を使用する方法を示しています。

AWS CLI

ノードの関連付けを解除するには

次の disassociate-node コマンドは、i-44de882p という名前のノードの関連付けを解除し、automate-06 という名前の Chef Automate サーバーによる管理からノードを削除します。有効なノード名は EC2 インスタンス ID です。

aws opsworks-cm disassociate-node --server-name "automate-06" --node-name "i-43de882p" --engine-attributes "Name=CHEF_ORGANIZATION,Value='MyOrganization' Name=CHEF_NODE_PUBLIC_KEY,Value='Public_key_contents'"

コマンドによって返される出力は次のようになります。出力:

{ "NodeAssociationStatusToken": "AHUY8wFe4pdXtZC5DiJa5SOLp5o14DH//rHRqHDWXxwVoNBxcEy4V7R0NOFymh7E/1HumOBPsemPQFE6dcGaiFk" }

詳細情報

詳細については、「AWS OpsWorks User Guide」の「Delete an AWS OpsWorks for Chef Automate Server」を参照してください。

  • API の詳細については、「AWS CLI コマンドリファレンス」の「DisassociateNode」を参照してください。

次の例は、restore-server を使用する方法を説明しています。

AWS CLI

サーバーを復元するには

次の restore-server コマンドは、ID が automate-06-2016-11-22T16:13:27.998Z のバックアップから、デフォルトのリージョンにある automate-06 という名前の Chef Automate サーバーのインプレース復元を行います。サーバーを復元すると、指定したバックアップの実行時に Chef Automate サーバーが管理していたノードへの接続が復元されます。

aws opsworks-cm restore-server --backup-id "automate-06-2016-11-22T16:13:27.998Z" --server-name "automate-06"

出力はコマンド ID のみです。出力:

(None)

詳細情報

詳細については、「AWS OpsWorks User Guide」の「Restore a Failed AWS OpsWorks for Chef Automate Server」を参照してください。

  • API の詳細については、「AWS CLI コマンドリファレンス」の「RestoreServer」を参照してください。

次の例は、restore-server を使用する方法を説明しています。

AWS CLI

サーバーを復元するには

次の restore-server コマンドは、ID が automate-06-2016-11-22T16:13:27.998Z のバックアップから、デフォルトのリージョンにある automate-06 という名前の Chef Automate サーバーのインプレース復元を行います。サーバーを復元すると、指定したバックアップの実行時に Chef Automate サーバーが管理していたノードへの接続が復元されます。

aws opsworks-cm restore-server --backup-id "automate-06-2016-11-22T16:13:27.998Z" --server-name "automate-06"

出力はコマンド ID のみです。出力:

(None)

詳細情報

詳細については、「AWS OpsWorks User Guide」の「Restore a Failed AWS OpsWorks for Chef Automate Server」を参照してください。

  • API の詳細については、「AWS CLI コマンドリファレンス」の「RestoreServer」を参照してください。

次のコード例は、start-maintenance を使用する方法を示しています。

AWS CLI

メンテナンスを開始するには

次の start-maintenance の例では、デフォルトのリージョンの指定された Chef Automate または Puppet Enterprise サーバーで、メンテナンスを手動で開始します。このコマンドは、以前の自動メンテナンスの試行が失敗し、メンテナンス失敗の根本的な原因が解決された場合に役立ちます。

aws opsworks-cm start-maintenance \ --server-name 'automate-06'

出力:

{ "Server": { "AssociatePublicIpAddress": true, "BackupRetentionCount": 10, "ServerName": "automate-06", "CreatedAt": 1569229584.842, "CloudFormationStackArn": "arn:aws:cloudformation:us-west-2:123456789012:stack/aws-opsworks-cm-instance-automate-06-1606611794746/EXAMPLE0-31de-11eb-bdb0-0a5b0a1353b8", "DisableAutomatedBackup": false, "Endpoint": "automate-06-EXAMPLEvr8gjfk5f.us-west-2.opsworks-cm.io", "Engine": "ChefAutomate", "EngineModel": "Single", "EngineAttributes": [], "EngineVersion": "2020-07", "InstanceProfileArn": "arn:aws:iam::123456789012:instance-profile/aws-opsworks-cm-ec2-role", "InstanceType": "m5.large", "PreferredMaintenanceWindow": "Sun:01:00", "PreferredBackupWindow": "Sun:15:00", "SecurityGroupIds": [ "sg-EXAMPLE" ], "ServiceRoleArn": "arn:aws:iam::123456789012:role/service-role/aws-opsworks-cm-service-role", "Status": "UNDER_MAINTENANCE", "SubnetIds": [ "subnet-EXAMPLE" ], "ServerArn": "arn:aws:opsworks-cm:us-west-2:123456789012:server/automate-06/0148382d-66b0-4196-8274-d1a2b6dff8d1" } }

詳細については、「AWS OpsWorks User Guide」の「System Maintenance (Puppet Enterprise servers)」または「System Maintenance (Chef Automate servers)」を参照してください。

  • API の詳細については、「AWS CLI コマンドリファレンス」の「StartMaintenance」を参照してください。

次のコード例は、start-maintenance を使用する方法を示しています。

AWS CLI

メンテナンスを開始するには

次の start-maintenance の例では、デフォルトのリージョンの指定された Chef Automate または Puppet Enterprise サーバーで、メンテナンスを手動で開始します。このコマンドは、以前の自動メンテナンスの試行が失敗し、メンテナンス失敗の根本的な原因が解決された場合に役立ちます。

aws opsworks-cm start-maintenance \ --server-name 'automate-06'

出力:

{ "Server": { "AssociatePublicIpAddress": true, "BackupRetentionCount": 10, "ServerName": "automate-06", "CreatedAt": 1569229584.842, "CloudFormationStackArn": "arn:aws:cloudformation:us-west-2:123456789012:stack/aws-opsworks-cm-instance-automate-06-1606611794746/EXAMPLE0-31de-11eb-bdb0-0a5b0a1353b8", "DisableAutomatedBackup": false, "Endpoint": "automate-06-EXAMPLEvr8gjfk5f.us-west-2.opsworks-cm.io", "Engine": "ChefAutomate", "EngineModel": "Single", "EngineAttributes": [], "EngineVersion": "2020-07", "InstanceProfileArn": "arn:aws:iam::123456789012:instance-profile/aws-opsworks-cm-ec2-role", "InstanceType": "m5.large", "PreferredMaintenanceWindow": "Sun:01:00", "PreferredBackupWindow": "Sun:15:00", "SecurityGroupIds": [ "sg-EXAMPLE" ], "ServiceRoleArn": "arn:aws:iam::123456789012:role/service-role/aws-opsworks-cm-service-role", "Status": "UNDER_MAINTENANCE", "SubnetIds": [ "subnet-EXAMPLE" ], "ServerArn": "arn:aws:opsworks-cm:us-west-2:123456789012:server/automate-06/0148382d-66b0-4196-8274-d1a2b6dff8d1" } }

詳細については、「AWS OpsWorks User Guide」の「System Maintenance (Puppet Enterprise servers)」または「System Maintenance (Chef Automate servers)」を参照してください。

  • API の詳細については、「AWS CLI コマンドリファレンス」の「StartMaintenance」を参照してください。

次のコード例は、update-server-engine-attributes を使用する方法を示しています。

AWS CLI

サーバーのエンジン属性を更新するには

次の update-server-engine-attributes コマンドは、automate-06 という名前の Chef Automate サーバーの CHEF_PIVOTAL_KEY エンジン属性の値を更新します。現在のところ、他のエンジン属性の値を変更することはできません。

aws opsworks-cm update-server-engine-attributes \ --attribute-name CHEF_PIVOTAL_KEY \ --attribute-value "new key value" \ --server-name "automate-06"

出力には、更新されたサーバーに関する次のような情報が表示されます。

{ "Server": { "BackupRetentionCount": 2, "CreatedAt": 2016-07-29T13:38:47.520Z, "DisableAutomatedBackup": FALSE, "Endpoint": "https://opsworks-cm.us-east-1.amazonaws.com", "Engine": "Chef", "EngineAttributes": [ { "Name": "CHEF_PIVOTAL_KEY", "Value": "new key value" } ], "EngineModel": "Single", "EngineVersion": "12", "InstanceProfileArn": "arn:aws:iam::1019881987024:instance-profile/automate-06-1010V4UU2WRM2", "InstanceType": "m4.large", "KeyPair": "", "MaintenanceStatus": "SUCCESS", "PreferredBackupWindow": "Mon:09:15", "PreferredMaintenanceWindow": "03:00", "SecurityGroupIds": [ "sg-1a24c270" ], "ServerArn": "arn:aws:iam::1019881987024:instance/automate-06-1010V4UU2WRM2", "ServerName": "automate-06", "ServiceRoleArn": "arn:aws:iam::1019881987024:role/aws-opsworks-cm-service-role.1114810729735", "Status": "HEALTHY", "StatusReason": "", "SubnetIds": [ "subnet-49436a18" ] } }

詳細については、「AWS OpsWorks for Chef Automate API Reference」の「UpdateServerEngineAttributes」を参照してください。

  • API の詳細については、「AWS CLI コマンドリファレンス」の「UpdateServerEngineAttributes」を参照してください。

次のコード例は、update-server-engine-attributes を使用する方法を示しています。

AWS CLI

サーバーのエンジン属性を更新するには

次の update-server-engine-attributes コマンドは、automate-06 という名前の Chef Automate サーバーの CHEF_PIVOTAL_KEY エンジン属性の値を更新します。現在のところ、他のエンジン属性の値を変更することはできません。

aws opsworks-cm update-server-engine-attributes \ --attribute-name CHEF_PIVOTAL_KEY \ --attribute-value "new key value" \ --server-name "automate-06"

出力には、更新されたサーバーに関する次のような情報が表示されます。

{ "Server": { "BackupRetentionCount": 2, "CreatedAt": 2016-07-29T13:38:47.520Z, "DisableAutomatedBackup": FALSE, "Endpoint": "https://opsworks-cm.us-east-1.amazonaws.com", "Engine": "Chef", "EngineAttributes": [ { "Name": "CHEF_PIVOTAL_KEY", "Value": "new key value" } ], "EngineModel": "Single", "EngineVersion": "12", "InstanceProfileArn": "arn:aws:iam::1019881987024:instance-profile/automate-06-1010V4UU2WRM2", "InstanceType": "m4.large", "KeyPair": "", "MaintenanceStatus": "SUCCESS", "PreferredBackupWindow": "Mon:09:15", "PreferredMaintenanceWindow": "03:00", "SecurityGroupIds": [ "sg-1a24c270" ], "ServerArn": "arn:aws:iam::1019881987024:instance/automate-06-1010V4UU2WRM2", "ServerName": "automate-06", "ServiceRoleArn": "arn:aws:iam::1019881987024:role/aws-opsworks-cm-service-role.1114810729735", "Status": "HEALTHY", "StatusReason": "", "SubnetIds": [ "subnet-49436a18" ] } }

詳細については、「AWS OpsWorks for Chef Automate API Reference」の「UpdateServerEngineAttributes」を参照してください。

  • API の詳細については、「AWS CLI コマンドリファレンス」の「UpdateServerEngineAttributes」を参照してください。

次のコード例は、update-server を使用する方法を示しています。

AWS CLI

サーバーを更新するには

次の update-server コマンドは、デフォルトのリージョンで指定された Chef Automate サーバーのメンテナンス開始時刻を更新します。--preferred-maintenance-window パラメータを追加して、サーバーメンテナンスの開始日時を月曜日の午前 9 時 15 分 (UTC) に変更しています。

aws opsworks-cm update-server \ --server-name "automate-06" \ --preferred-maintenance-window "Mon:09:15"

出力には、更新されたサーバーに関する次のような情報が表示されます。

{ "Server": { "BackupRetentionCount": 8, "CreatedAt": 2016-07-29T13:38:47.520Z, "DisableAutomatedBackup": TRUE, "Endpoint": "https://opsworks-cm.us-east-1.amazonaws.com", "Engine": "Chef", "EngineAttributes": [ { "Name": "CHEF_DELIVERY_ADMIN_PASSWORD", "Value": "1Password1" } ], "EngineModel": "Single", "EngineVersion": "12", "InstanceProfileArn": "arn:aws:iam::1019881987024:instance-profile/automate-06-1010V4UU2WRM2", "InstanceType": "m4.large", "KeyPair": "", "MaintenanceStatus": "OK", "PreferredBackupWindow": "Mon:09:15", "PreferredMaintenanceWindow": "03:00", "SecurityGroupIds": [ "sg-1a24c270" ], "ServerArn": "arn:aws:iam::1019881987024:instance/automate-06-1010V4UU2WRM2", "ServerName": "automate-06", "ServiceRoleArn": "arn:aws:iam::1019881987024:role/aws-opsworks-cm-service-role.1114810729735", "Status": "HEALTHY", "StatusReason": "", "SubnetIds": [ "subnet-49436a18" ] } }

詳細については、「AWS OpsWorks for Chef Automate API Reference」の「UpdateServer」を参照してください。

  • API の詳細については、「AWS CLI コマンドリファレンス」の「UpdateServer」を参照してください。

次のコード例は、update-server を使用する方法を示しています。

AWS CLI

サーバーを更新するには

次の update-server コマンドは、デフォルトのリージョンで指定された Chef Automate サーバーのメンテナンス開始時刻を更新します。--preferred-maintenance-window パラメータを追加して、サーバーメンテナンスの開始日時を月曜日の午前 9 時 15 分 (UTC) に変更しています。

aws opsworks-cm update-server \ --server-name "automate-06" \ --preferred-maintenance-window "Mon:09:15"

出力には、更新されたサーバーに関する次のような情報が表示されます。

{ "Server": { "BackupRetentionCount": 8, "CreatedAt": 2016-07-29T13:38:47.520Z, "DisableAutomatedBackup": TRUE, "Endpoint": "https://opsworks-cm.us-east-1.amazonaws.com", "Engine": "Chef", "EngineAttributes": [ { "Name": "CHEF_DELIVERY_ADMIN_PASSWORD", "Value": "1Password1" } ], "EngineModel": "Single", "EngineVersion": "12", "InstanceProfileArn": "arn:aws:iam::1019881987024:instance-profile/automate-06-1010V4UU2WRM2", "InstanceType": "m4.large", "KeyPair": "", "MaintenanceStatus": "OK", "PreferredBackupWindow": "Mon:09:15", "PreferredMaintenanceWindow": "03:00", "SecurityGroupIds": [ "sg-1a24c270" ], "ServerArn": "arn:aws:iam::1019881987024:instance/automate-06-1010V4UU2WRM2", "ServerName": "automate-06", "ServiceRoleArn": "arn:aws:iam::1019881987024:role/aws-opsworks-cm-service-role.1114810729735", "Status": "HEALTHY", "StatusReason": "", "SubnetIds": [ "subnet-49436a18" ] } }

詳細については、「AWS OpsWorks for Chef Automate API Reference」の「UpdateServer」を参照してください。

  • API の詳細については、「AWS CLI コマンドリファレンス」の「UpdateServer」を参照してください。

このページの内容

プライバシーサイト規約Cookie の設定
© 2025, Amazon Web Services, Inc. or its affiliates.All rights reserved.