Cookie の設定を選択する

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

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

AWS SDK for PHP バージョン 3 での Amazon アラームでの CloudWatch アラームアクションの使用 - AWS SDK for PHP

翻訳は機械翻訳により提供されています。提供された翻訳内容と英語版の間で齟齬、不一致または矛盾がある場合、英語版が優先します。

翻訳は機械翻訳により提供されています。提供された翻訳内容と英語版の間で齟齬、不一致または矛盾がある場合、英語版が優先します。

AWS SDK for PHP バージョン 3 での Amazon アラームでの CloudWatch アラームアクションの使用

アラームアクションを使用して、Amazon EC2 インスタンスを自動的に停止、終了、再起動、または復旧するアラームを作成します。今後インスタンスを実行する必要がなくなったときに、停止または終了アクションを使用できます。再起動と復元アクションを使用して、自動的にそのインスタンスを再起動できます。

以下の例では、次の方法を示しています。

  • を使用して、指定したアラームのアクションを有効にしますEnableAlarmActions

  • を使用して、指定したアラームのアクションを無効にしますDisableAlarmActions

のすべてのサンプルコードAWS SDK for PHPは、 にあります GitHub

認証情報

サンプルコードを実行する前に、AWS の認証情報を設定します (認証情報 を参照)。AWS SDK for PHP からのインポート (基本的な使用法 を参照)。

アラームアクションの有効化

インポート

require 'vendor/autoload.php'; use Aws\CloudWatch\CloudWatchClient; use Aws\Exception\AwsException;

サンプルコード

function enableAlarmActions($cloudWatchClient, $alarmNames) { try { $result = $cloudWatchClient->enableAlarmActions([ 'AlarmNames' => $alarmNames ]); if (isset($result['@metadata']['effectiveUri'])) { return 'At the effective URI of ' . $result['@metadata']['effectiveUri'] . ', actions for any matching alarms have been enabled.'; } else { return'Actions for some matching alarms ' . 'might not have been enabled.'; } } catch (AwsException $e) { return 'Error: ' . $e->getAwsErrorMessage(); } } function enableTheAlarmActions() { $alarmNames = array('my-alarm'); $cloudWatchClient = new CloudWatchClient([ 'profile' => 'default', 'region' => 'us-east-1', 'version' => '2010-08-01' ]); echo enableAlarmActions($cloudWatchClient, $alarmNames); } // Uncomment the following line to run this code in an AWS account. // enableTheAlarmActions();

アラームアクションの無効化

インポート

require 'vendor/autoload.php'; use Aws\CloudWatch\CloudWatchClient; use Aws\Exception\AwsException;

サンプルコード

function disableAlarmActions($cloudWatchClient, $alarmNames) { try { $result = $cloudWatchClient->disableAlarmActions([ 'AlarmNames' => $alarmNames ]); if (isset($result['@metadata']['effectiveUri'])) { return 'At the effective URI of ' . $result['@metadata']['effectiveUri'] . ', actions for any matching alarms have been disabled.'; } else { return 'Actions for some matching alarms ' . 'might not have been disabled.'; } } catch (AwsException $e) { return 'Error: ' . $e->getAwsErrorMessage(); } } function disableTheAlarmActions() { $alarmNames = array('my-alarm'); $cloudWatchClient = new CloudWatchClient([ 'profile' => 'default', 'region' => 'us-east-1', 'version' => '2010-08-01' ]); echo disableAlarmActions($cloudWatchClient, $alarmNames); } // Uncomment the following line to run this code in an AWS account. // disableTheAlarmActions();
プライバシーサイト規約Cookie の設定
© 2025, Amazon Web Services, Inc. or its affiliates.All rights reserved.