【AWS】AWS SDK for Ruby (3.0.1) で CloudWatch のメトリクスを取得する手順

公開日時:2021年02月14日 / 最終更新日時:2021年02月14日

AWS SDK for Ruby (バージョン 3.0.1) で CloudWatch のメトリクスを取得する手順について解説します。

日常的に業務で AWS でインフラを運用管理している私としては GUI でボタンをクリックして設定していくスタイルから徐々に CUI またはプログラムでの運用管理に移行したいと考えています。

 

まずは Ruby で試してみました。

 

Python で CloudWatch のメトリクスを取得する手順は以下の記事を参考にしてください。

 

【AWS】AWS SDK for Python (Boto3) で CloudWatch のメトリクスを取得する手順

 

 

 

プログラムで CloudWatch メトリクスを取得したいと思った理由

コマンドラインやプログラムで CloudWatch のメトリクスを取得したいと思った理由としては、以下の記事のように Zabbix とも連携できてよりレベルの高い運用保守ができるのではと考えたからです。

 

ZabbixでAWS/CloudWatchの値を取得してみた

https://dev.classmethod.jp/articles/zabbix-with-cloudwatch/

 

 

 

 

 

CentOS8 で AWS SDK for Ruby バージョン 3 を試す

まずは上の記事にある通りにAWS SDK for Ruby」を試しました。

ただし、記事は古いバージョン(バージョン 2?)だったのでバージョン 3 を試しました。

 

CentOS8 ではデフォルトで Ruby がインストールされていない為、別途インストールが必要になります。

 

■OS は CentOS8.3

[root@test01 ~]# cat /etc/redhat-release 
CentOS Linux release 8.3.2011 
[root@test01 ~]# 

 

 

 

■Ruby のインストール

※yum install ruby を実行すると Ruby 2.5 がインストールされます。

[root@test01 ~]# yum install ruby 
Last metadata expiration check: 0:26:21 ago on Fri 12 Feb 2021 09:46:48 AM JST. 
Dependencies resolved. 
========================================================================================== 
 Package               Arch    Version                                   Repository  Size 
========================================================================================== 
Installing: 
 ruby                  x86_64  2.5.5-106.module_el8.3.0+571+bab7c6bc     appstream   86 k 
Installing dependencies: 
 ruby-irb              noarch  2.5.5-106.module_el8.3.0+571+bab7c6bc     appstream  102 k 
 ruby-libs             x86_64  2.5.5-106.module_el8.3.0+571+bab7c6bc     appstream  2.9 M 
 rubygem-json          x86_64  2.1.0-106.module_el8.3.0+571+bab7c6bc     appstream   90 k 
 rubygem-psych         x86_64  3.0.2-106.module_el8.3.0+571+bab7c6bc     appstream   95 k 
Installing weak dependencies: 
 rubygem-bigdecimal    x86_64  1.3.4-106.module_el8.3.0+571+bab7c6bc     appstream   97 k 
 rubygem-did_you_mean  noarch  1.2.0-106.module_el8.3.0+571+bab7c6bc     appstream   81 k 
 rubygem-io-console    x86_64  0.4.6-106.module_el8.3.0+571+bab7c6bc     appstream   66 k 
 rubygem-openssl       x86_64  2.1.2-106.module_el8.3.0+571+bab7c6bc     appstream  189 k 
 rubygem-rdoc          noarch  6.0.1-106.module_el8.3.0+571+bab7c6bc     appstream  486 k 
 rubygems              noarch  2.7.6.2-106.module_el8.3.0+571+bab7c6bc   appstream  308 k 
Enabling module streams: 
 ruby                          2.5 
 
Transaction Summary 
========================================================================================== 
Install  11 Packages 
 
Total download size: 4.5 M 
Installed size: 14 M 
Is this ok [y/N]: y 
Downloading Packages: 
(1/11): ruby-irb-2.5.5-106.module_el8.3.0+571+bab7c6bc.no 523 kB/s | 102 kB     00:00 
(2/11): ruby-2.5.5-106.module_el8.3.0+571+bab7c6bc.x86_64 235 kB/s |  86 kB     00:00 
(3/11): rubygem-bigdecimal-1.3.4-106.module_el8.3.0+571+b 252 kB/s |  97 kB     00:00 
(4/11): rubygem-io-console-0.4.6-106.module_el8.3.0+571+b 395 kB/s |  66 kB     00:00 
(5/11): rubygem-did_you_mean-1.2.0-106.module_el8.3.0+571 167 kB/s |  81 kB     00:00 
(6/11): ruby-libs-2.5.5-106.module_el8.3.0+571+bab7c6bc.x 3.0 MB/s | 2.9 MB     00:00 
(7/11): rubygem-json-2.1.0-106.module_el8.3.0+571+bab7c6b 249 kB/s |  90 kB     00:00 
(8/11): rubygem-psych-3.0.2-106.module_el8.3.0+571+bab7c6 262 kB/s |  95 kB     00:00 
(9/11): rubygem-openssl-2.1.2-106.module_el8.3.0+571+bab7 312 kB/s | 189 kB     00:00 
(10/11): rubygem-rdoc-6.0.1-106.module_el8.3.0+571+bab7c6 619 kB/s | 486 kB     00:00 
(11/11): rubygems-2.7.6.2-106.module_el8.3.0+571+bab7c6bc 435 kB/s | 308 kB     00:00 
------------------------------------------------------------------------------------------ 
Total                                                     1.7 MB/s | 4.5 MB     00:02 
Running transaction check 
Transaction check succeeded. 
Running transaction test 
Transaction test succeeded. 
Running transaction 
  Preparing        :                                                                  1/1 
  Installing       : ruby-libs-2.5.5-106.module_el8.3.0+571+bab7c6bc.x86_64          1/11 
  Installing       : ruby-irb-2.5.5-106.module_el8.3.0+571+bab7c6bc.noarch           2/11 
  Installing       : rubygem-bigdecimal-1.3.4-106.module_el8.3.0+571+bab7c6bc.x86    3/11 
  Installing       : rubygem-did_you_mean-1.2.0-106.module_el8.3.0+571+bab7c6bc.n    4/11 
  Installing       : rubygem-io-console-0.4.6-106.module_el8.3.0+571+bab7c6bc.x86    5/11 
  Installing       : rubygem-json-2.1.0-106.module_el8.3.0+571+bab7c6bc.x86_64       6/11 
  Installing       : rubygem-openssl-2.1.2-106.module_el8.3.0+571+bab7c6bc.x86_64    7/11 
  Installing       : rubygem-psych-3.0.2-106.module_el8.3.0+571+bab7c6bc.x86_64      8/11 
  Installing       : rubygem-rdoc-6.0.1-106.module_el8.3.0+571+bab7c6bc.noarch       9/11 
  Installing       : rubygems-2.7.6.2-106.module_el8.3.0+571+bab7c6bc.noarch        10/11 
  Installing       : ruby-2.5.5-106.module_el8.3.0+571+bab7c6bc.x86_64              11/11 
  Running scriptlet: ruby-2.5.5-106.module_el8.3.0+571+bab7c6bc.x86_64              11/11 
  Verifying        : ruby-2.5.5-106.module_el8.3.0+571+bab7c6bc.x86_64               1/11 
  Verifying        : ruby-irb-2.5.5-106.module_el8.3.0+571+bab7c6bc.noarch           2/11 
  Verifying        : ruby-libs-2.5.5-106.module_el8.3.0+571+bab7c6bc.x86_64          3/11 
  Verifying        : rubygem-bigdecimal-1.3.4-106.module_el8.3.0+571+bab7c6bc.x86    4/11 
  Verifying        : rubygem-did_you_mean-1.2.0-106.module_el8.3.0+571+bab7c6bc.n    5/11 
  Verifying        : rubygem-io-console-0.4.6-106.module_el8.3.0+571+bab7c6bc.x86    6/11 
  Verifying        : rubygem-json-2.1.0-106.module_el8.3.0+571+bab7c6bc.x86_64       7/11 
  Verifying        : rubygem-openssl-2.1.2-106.module_el8.3.0+571+bab7c6bc.x86_64    8/11 
  Verifying        : rubygem-psych-3.0.2-106.module_el8.3.0+571+bab7c6bc.x86_64      9/11 
  Verifying        : rubygem-rdoc-6.0.1-106.module_el8.3.0+571+bab7c6bc.noarch      10/11 
  Verifying        : rubygems-2.7.6.2-106.module_el8.3.0+571+bab7c6bc.noarch        11/11 
 
Installed: 
  ruby-2.5.5-106.module_el8.3.0+571+bab7c6bc.x86_64 
  ruby-irb-2.5.5-106.module_el8.3.0+571+bab7c6bc.noarch 
  ruby-libs-2.5.5-106.module_el8.3.0+571+bab7c6bc.x86_64 
  rubygem-bigdecimal-1.3.4-106.module_el8.3.0+571+bab7c6bc.x86_64 
  rubygem-did_you_mean-1.2.0-106.module_el8.3.0+571+bab7c6bc.noarch 
  rubygem-io-console-0.4.6-106.module_el8.3.0+571+bab7c6bc.x86_64 
  rubygem-json-2.1.0-106.module_el8.3.0+571+bab7c6bc.x86_64 
  rubygem-openssl-2.1.2-106.module_el8.3.0+571+bab7c6bc.x86_64 
  rubygem-psych-3.0.2-106.module_el8.3.0+571+bab7c6bc.x86_64 
  rubygem-rdoc-6.0.1-106.module_el8.3.0+571+bab7c6bc.noarch 
  rubygems-2.7.6.2-106.module_el8.3.0+571+bab7c6bc.noarch 
 
Complete! 
[root@test01 ~]# 

 

 

■Ruby のバージョン確認

[root@test01 ~]# ruby -v 
ruby 2.5.5p157 (2019-03-15 revision 67260) [x86_64-linux] 
[root@test01 ~]# 

 

Ruby の最新バージョンが 3.0.0 なので、それに比べると古いです。

 

 

 

■gem のバージョン確認

[root@test01 ~]# gem --version 
2.7.6.2 
[root@test01 ~]# 

 

 

■AWS SDK for Ruby のインストール

[root@test01 ~]# gem install aws-sdk 
Fetching: jmespath-1.4.0.gem (100%) 
Successfully installed jmespath-1.4.0 
Fetching: aws-partitions-1.426.0.gem (100%) 
Successfully installed aws-partitions-1.426.0 
Fetching: aws-eventstream-1.1.0.gem (100%) 
Successfully installed aws-eventstream-1.1.0 
Fetching: aws-sigv4-1.2.2.gem (100%) 
Successfully installed aws-sigv4-1.2.2 
Fetching: aws-sdk-core-3.112.0.gem (100%) 
Successfully installed aws-sdk-core-3.112.0 ← AWS SDK for Ruby バージョン 3 がインストールされています。 
Fetching: aws-sdk-acm-1.39.0.gem (100%) 
Successfully installed aws-sdk-acm-1.39.0 
Fetching: aws-sdk-acmpca-1.33.0.gem (100%) 
Successfully installed aws-sdk-acmpca-1.33.0 
Fetching: aws-sdk-apigateway-1.59.0.gem (100%) 
Successfully installed aws-sdk-apigateway-1.59.0 
Fetching: aws-sdk-accessanalyzer-1.16.0.gem (100%) 
Successfully installed aws-sdk-accessanalyzer-1.16.0 
Fetching: aws-sdk-alexaforbusiness-1.44.0.gem (100%) 
Successfully installed aws-sdk-alexaforbusiness-1.44.0 
Fetching: aws-sdk-amplify-1.28.0.gem (100%) 
Successfully installed aws-sdk-amplify-1.28.0 
Fetching: aws-sdk-amplifybackend-1.2.0.gem (100%) 
Successfully installed aws-sdk-amplifybackend-1.2.0 
Fetching: aws-sdk-apigatewaymanagementapi-1.20.0.gem (100%) 
Successfully installed aws-sdk-apigatewaymanagementapi-1.20.0 
Fetching: aws-sdk-apigatewayv2-1.31.0.gem (100%) 
Successfully installed aws-sdk-apigatewayv2-1.31.0 
Fetching: aws-sdk-appconfig-1.13.0.gem (100%) 
Successfully installed aws-sdk-appconfig-1.13.0 
Fetching: aws-sdk-appintegrationsservice-1.1.0.gem (100%) 
Successfully installed aws-sdk-appintegrationsservice-1.1.0 
Fetching: aws-sdk-appmesh-1.34.0.gem (100%) 
Successfully installed aws-sdk-appmesh-1.34.0 
Fetching: aws-sdk-appregistry-1.4.0.gem (100%) 
Successfully installed aws-sdk-appregistry-1.4.0 
Fetching: aws-sdk-appstream-1.50.0.gem (100%) 
Successfully installed aws-sdk-appstream-1.50.0 
Fetching: aws-sdk-appsync-1.38.0.gem (100%) 
Successfully installed aws-sdk-appsync-1.38.0 
Fetching: aws-sdk-appflow-1.6.0.gem (100%) 
Successfully installed aws-sdk-appflow-1.6.0 
Fetching: aws-sdk-applicationautoscaling-1.50.0.gem (100%) 
Successfully installed aws-sdk-applicationautoscaling-1.50.0 
Fetching: aws-sdk-applicationdiscoveryservice-1.34.0.gem (100%) 
Successfully installed aws-sdk-applicationdiscoveryservice-1.34.0 
Fetching: aws-sdk-applicationinsights-1.17.0.gem (100%) 
Successfully installed aws-sdk-applicationinsights-1.17.0 
Fetching: aws-sdk-athena-1.35.0.gem (100%) 
Successfully installed aws-sdk-athena-1.35.0 
Fetching: aws-sdk-auditmanager-1.3.0.gem (100%) 
Successfully installed aws-sdk-auditmanager-1.3.0 
Fetching: aws-sdk-augmentedairuntime-1.11.0.gem (100%) 
Successfully installed aws-sdk-augmentedairuntime-1.11.0 
Fetching: aws-sdk-autoscaling-1.54.0.gem (100%) 
Successfully installed aws-sdk-autoscaling-1.54.0 
Fetching: aws-sdk-autoscalingplans-1.30.0.gem (100%) 
Successfully installed aws-sdk-autoscalingplans-1.30.0 
Fetching: aws-sdk-backup-1.27.0.gem (100%) 
Successfully installed aws-sdk-backup-1.27.0 
Fetching: aws-sdk-batch-1.44.0.gem (100%) 
Successfully installed aws-sdk-batch-1.44.0 
Fetching: aws-sdk-braket-1.6.0.gem (100%) 
Successfully installed aws-sdk-braket-1.6.0 
Fetching: aws-sdk-budgets-1.37.0.gem (100%) 
Successfully installed aws-sdk-budgets-1.37.0 
Fetching: aws-sdk-chime-1.41.0.gem (100%) 
Successfully installed aws-sdk-chime-1.41.0 
Fetching: aws-sdk-cloud9-1.30.0.gem (100%) 
Successfully installed aws-sdk-cloud9-1.30.0 
Fetching: aws-sdk-clouddirectory-1.30.0.gem (100%) 
Successfully installed aws-sdk-clouddirectory-1.30.0 
Fetching: aws-sdk-cloudformation-1.47.0.gem (100%) 
Successfully installed aws-sdk-cloudformation-1.47.0 
Fetching: aws-sdk-cloudfront-1.48.0.gem (100%) 
Successfully installed aws-sdk-cloudfront-1.48.0 
Fetching: aws-sdk-cloudhsm-1.28.0.gem (100%) 
Successfully installed aws-sdk-cloudhsm-1.28.0 
Fetching: aws-sdk-cloudhsmv2-1.32.0.gem (100%) 
Successfully installed aws-sdk-cloudhsmv2-1.32.0 
Fetching: aws-sdk-cloudsearch-1.28.0.gem (100%) 
Successfully installed aws-sdk-cloudsearch-1.28.0 
Fetching: aws-sdk-cloudsearchdomain-1.23.0.gem (100%) 
Successfully installed aws-sdk-cloudsearchdomain-1.23.0 
Fetching: aws-sdk-cloudtrail-1.33.0.gem (100%) 
Successfully installed aws-sdk-cloudtrail-1.33.0 
Fetching: aws-sdk-cloudwatch-1.49.0.gem (100%) 
Successfully installed aws-sdk-cloudwatch-1.49.0 
Fetching: aws-sdk-cloudwatchevents-1.41.0.gem (100%) 
Successfully installed aws-sdk-cloudwatchevents-1.41.0 
Fetching: aws-sdk-cloudwatchlogs-1.39.0.gem (100%) 
Successfully installed aws-sdk-cloudwatchlogs-1.39.0 
Fetching: aws-sdk-codeartifact-1.7.0.gem (100%) 
Successfully installed aws-sdk-codeartifact-1.7.0 
Fetching: aws-sdk-codebuild-1.67.0.gem (100%) 
Successfully installed aws-sdk-codebuild-1.67.0 
Fetching: aws-sdk-codecommit-1.41.0.gem (100%) 
Successfully installed aws-sdk-codecommit-1.41.0 
Fetching: aws-sdk-codedeploy-1.38.0.gem (100%) 
Successfully installed aws-sdk-codedeploy-1.38.0 
Fetching: aws-sdk-codeguruprofiler-1.13.0.gem (100%) 
Successfully installed aws-sdk-codeguruprofiler-1.13.0 
Fetching: aws-sdk-codegurureviewer-1.15.0.gem (100%) 
Successfully installed aws-sdk-codegurureviewer-1.15.0 
Fetching: aws-sdk-codepipeline-1.40.0.gem (100%) 
Successfully installed aws-sdk-codepipeline-1.40.0 
Fetching: aws-sdk-codestar-1.28.0.gem (100%) 
Successfully installed aws-sdk-codestar-1.28.0 
Fetching: aws-sdk-codestarnotifications-1.9.0.gem (100%) 
Successfully installed aws-sdk-codestarnotifications-1.9.0 
Fetching: aws-sdk-codestarconnections-1.13.0.gem (100%) 
Successfully installed aws-sdk-codestarconnections-1.13.0 
Fetching: aws-sdk-cognitoidentity-1.30.0.gem (100%) 
Successfully installed aws-sdk-cognitoidentity-1.30.0 
Fetching: aws-sdk-cognitoidentityprovider-1.49.0.gem (100%) 
Successfully installed aws-sdk-cognitoidentityprovider-1.49.0 
Fetching: aws-sdk-cognitosync-1.25.0.gem (100%) 
Successfully installed aws-sdk-cognitosync-1.25.0 
Fetching: aws-sdk-comprehend-1.43.0.gem (100%) 
Successfully installed aws-sdk-comprehend-1.43.0 
Fetching: aws-sdk-comprehendmedical-1.24.0.gem (100%) 
Successfully installed aws-sdk-comprehendmedical-1.24.0 
Fetching: aws-sdk-computeoptimizer-1.13.0.gem (100%) 
Successfully installed aws-sdk-computeoptimizer-1.13.0 
Fetching: aws-sdk-configservice-1.56.0.gem (100%) 
Successfully installed aws-sdk-configservice-1.56.0 
Fetching: aws-sdk-connect-1.40.0.gem (100%) 
Successfully installed aws-sdk-connect-1.40.0 
Fetching: aws-sdk-connectcontactlens-1.1.0.gem (100%) 
Successfully installed aws-sdk-connectcontactlens-1.1.0 
Fetching: aws-sdk-connectparticipant-1.10.0.gem (100%) 
Successfully installed aws-sdk-connectparticipant-1.10.0 
Fetching: aws-sdk-costexplorer-1.58.0.gem (100%) 
Successfully installed aws-sdk-costexplorer-1.58.0 
Fetching: aws-sdk-costandusagereportservice-1.29.0.gem (100%) 
Successfully installed aws-sdk-costandusagereportservice-1.29.0 
Fetching: aws-sdk-customerprofiles-1.3.0.gem (100%) 
Successfully installed aws-sdk-customerprofiles-1.3.0 
Fetching: aws-sdk-dax-1.28.0.gem (100%) 
Successfully installed aws-sdk-dax-1.28.0 
Fetching: aws-sdk-dlm-1.39.0.gem (100%) 
Successfully installed aws-sdk-dlm-1.39.0 
Fetching: aws-sdk-dataexchange-1.12.0.gem (100%) 
Successfully installed aws-sdk-dataexchange-1.12.0 
Fetching: aws-sdk-datapipeline-1.25.0.gem (100%) 
Successfully installed aws-sdk-datapipeline-1.25.0 
Fetching: aws-sdk-datasync-1.29.0.gem (100%) 
Successfully installed aws-sdk-datasync-1.29.0 
Fetching: aws-sdk-databasemigrationservice-1.51.0.gem (100%) 
Successfully installed aws-sdk-databasemigrationservice-1.51.0 
Fetching: aws-sdk-detective-1.12.0.gem (100%) 
Successfully installed aws-sdk-detective-1.12.0 
Fetching: aws-sdk-devopsguru-1.3.0.gem (100%) 
Successfully installed aws-sdk-devopsguru-1.3.0 
Fetching: aws-sdk-devicefarm-1.40.0.gem (100%) 
Successfully installed aws-sdk-devicefarm-1.40.0 
Fetching: aws-sdk-directconnect-1.38.0.gem (100%) 
Successfully installed aws-sdk-directconnect-1.38.0 
Fetching: aws-sdk-directoryservice-1.38.0.gem (100%) 
Successfully installed aws-sdk-directoryservice-1.38.0 
Fetching: aws-sdk-docdb-1.28.0.gem (100%) 
Successfully installed aws-sdk-docdb-1.28.0 
Fetching: aws-sdk-dynamodb-1.59.0.gem (100%) 
Successfully installed aws-sdk-dynamodb-1.59.0 
Fetching: aws-sdk-dynamodbstreams-1.28.0.gem (100%) 
Successfully installed aws-sdk-dynamodbstreams-1.28.0 
Fetching: aws-sdk-ebs-1.12.0.gem (100%) 
Successfully installed aws-sdk-ebs-1.12.0 
Fetching: aws-sdk-ec2-1.224.0.gem (100%) 
Successfully installed aws-sdk-ec2-1.224.0 
Fetching: aws-sdk-ec2instanceconnect-1.12.0.gem (100%) 
Successfully installed aws-sdk-ec2instanceconnect-1.12.0 
Fetching: aws-sdk-ecr-1.41.0.gem (100%) 
Successfully installed aws-sdk-ecr-1.41.0 
Fetching: aws-sdk-ecrpublic-1.1.0.gem (100%) 
Successfully installed aws-sdk-ecrpublic-1.1.0 
Fetching: aws-sdk-ecs-1.74.0.gem (100%) 
Successfully installed aws-sdk-ecs-1.74.0 
Fetching: aws-sdk-efs-1.37.0.gem (100%) 
Successfully installed aws-sdk-efs-1.37.0 
Fetching: aws-sdk-eks-1.47.0.gem (100%) 
Successfully installed aws-sdk-eks-1.47.0 
Fetching: aws-sdk-emr-1.41.0.gem (100%) 
Successfully installed aws-sdk-emr-1.41.0 
Fetching: aws-sdk-emrcontainers-1.2.0.gem (100%) 
Successfully installed aws-sdk-emrcontainers-1.2.0 
Fetching: aws-sdk-elasticache-1.53.0.gem (100%) 
Successfully installed aws-sdk-elasticache-1.53.0 
Fetching: aws-sdk-elasticbeanstalk-1.41.0.gem (100%) 
Successfully installed aws-sdk-elasticbeanstalk-1.41.0 
Fetching: aws-sdk-elasticinference-1.11.0.gem (100%) 
Successfully installed aws-sdk-elasticinference-1.11.0 
Fetching: aws-sdk-elasticloadbalancing-1.30.0.gem (100%) 
Successfully installed aws-sdk-elasticloadbalancing-1.30.0 
Fetching: aws-sdk-elasticloadbalancingv2-1.59.0.gem (100%) 
Successfully installed aws-sdk-elasticloadbalancingv2-1.59.0 
Fetching: aws-sdk-elastictranscoder-1.28.0.gem (100%) 
Successfully installed aws-sdk-elastictranscoder-1.28.0 
Fetching: aws-sdk-elasticsearchservice-1.48.0.gem (100%) 
Successfully installed aws-sdk-elasticsearchservice-1.48.0 
Fetching: aws-sdk-eventbridge-1.19.0.gem (100%) 
Successfully installed aws-sdk-eventbridge-1.19.0 
Fetching: aws-sdk-fms-1.34.0.gem (100%) 
Successfully installed aws-sdk-fms-1.34.0 
Fetching: aws-sdk-fsx-1.34.0.gem (100%) 
Successfully installed aws-sdk-fsx-1.34.0 
Fetching: aws-sdk-firehose-1.36.0.gem (100%) 
Successfully installed aws-sdk-firehose-1.36.0 
Fetching: aws-sdk-forecastqueryservice-1.11.0.gem (100%) 
Successfully installed aws-sdk-forecastqueryservice-1.11.0 
Fetching: aws-sdk-forecastservice-1.15.0.gem (100%) 
Successfully installed aws-sdk-forecastservice-1.15.0 
Fetching: aws-sdk-frauddetector-1.16.0.gem (100%) 
Successfully installed aws-sdk-frauddetector-1.16.0 
Fetching: aws-sdk-gamelift-1.41.0.gem (100%) 
Successfully installed aws-sdk-gamelift-1.41.0 
Fetching: aws-sdk-glacier-1.36.0.gem (100%) 
Successfully installed aws-sdk-glacier-1.36.0 
Fetching: aws-sdk-globalaccelerator-1.29.0.gem (100%) 
Successfully installed aws-sdk-globalaccelerator-1.29.0 
Fetching: aws-sdk-glue-1.83.0.gem (100%) 
Successfully installed aws-sdk-glue-1.83.0 
Fetching: aws-sdk-gluedatabrew-1.4.0.gem (100%) 
Successfully installed aws-sdk-gluedatabrew-1.4.0 
Fetching: aws-sdk-greengrass-1.38.0.gem (100%) 
Successfully installed aws-sdk-greengrass-1.38.0 
Fetching: aws-sdk-greengrassv2-1.2.0.gem (100%) 
Successfully installed aws-sdk-greengrassv2-1.2.0 
Fetching: aws-sdk-groundstation-1.16.0.gem (100%) 
Successfully installed aws-sdk-groundstation-1.16.0 
Fetching: aws-sdk-guardduty-1.44.0.gem (100%) 
Successfully installed aws-sdk-guardduty-1.44.0 
Fetching: aws-sdk-health-1.32.0.gem (100%) 
Successfully installed aws-sdk-health-1.32.0 
Fetching: aws-sdk-healthlake-1.2.0.gem (100%) 
Successfully installed aws-sdk-healthlake-1.2.0 
Fetching: aws-sdk-honeycode-1.5.0.gem (100%) 
Successfully installed aws-sdk-honeycode-1.5.0 
Fetching: aws-sdk-iam-1.47.0.gem (100%) 
Successfully installed aws-sdk-iam-1.47.0 
Fetching: aws-sdk-ivs-1.7.0.gem (100%) 
Successfully installed aws-sdk-ivs-1.7.0 
Fetching: aws-sdk-identitystore-1.4.0.gem (100%) 
Successfully installed aws-sdk-identitystore-1.4.0 
Fetching: aws-sdk-imagebuilder-1.18.0.gem (100%) 
Successfully installed aws-sdk-imagebuilder-1.18.0 
Fetching: aws-sigv2-1.0.1.gem (100%) 
Successfully installed aws-sigv2-1.0.1 
Fetching: aws-sdk-importexport-1.25.0.gem (100%) 
Successfully installed aws-sdk-importexport-1.25.0 
Fetching: aws-sdk-inspector-1.33.0.gem (100%) 
Successfully installed aws-sdk-inspector-1.33.0 
Fetching: aws-sdk-iot-1.66.0.gem (100%) 
Successfully installed aws-sdk-iot-1.66.0 
Fetching: aws-sdk-iot1clickdevicesservice-1.27.0.gem (100%) 
Successfully installed aws-sdk-iot1clickdevicesservice-1.27.0 
Fetching: aws-sdk-iot1clickprojects-1.27.0.gem (100%) 
Successfully installed aws-sdk-iot1clickprojects-1.27.0 
Fetching: aws-sdk-iotanalytics-1.37.0.gem (100%) 
Successfully installed aws-sdk-iotanalytics-1.37.0 
Fetching: aws-sdk-iotdataplane-1.27.0.gem (100%) 
Successfully installed aws-sdk-iotdataplane-1.27.0 
Fetching: aws-sdk-iotdeviceadvisor-1.1.0.gem (100%) 
Successfully installed aws-sdk-iotdeviceadvisor-1.1.0 
Fetching: aws-sdk-iotevents-1.21.0.gem (100%) 
Successfully installed aws-sdk-iotevents-1.21.0 
Fetching: aws-sdk-ioteventsdata-1.14.0.gem (100%) 
Successfully installed aws-sdk-ioteventsdata-1.14.0 
Fetching: aws-sdk-iotfleethub-1.1.0.gem (100%) 
Successfully installed aws-sdk-iotfleethub-1.1.0 
Fetching: aws-sdk-iotjobsdataplane-1.26.0.gem (100%) 
Successfully installed aws-sdk-iotjobsdataplane-1.26.0 
Fetching: aws-sdk-iotsecuretunneling-1.10.0.gem (100%) 
Successfully installed aws-sdk-iotsecuretunneling-1.10.0 
Fetching: aws-sdk-iotsitewise-1.19.0.gem (100%) 
Successfully installed aws-sdk-iotsitewise-1.19.0 
Fetching: aws-sdk-iotthingsgraph-1.13.0.gem (100%) 
Successfully installed aws-sdk-iotthingsgraph-1.13.0 
Fetching: aws-sdk-iotwireless-1.2.0.gem (100%) 
Successfully installed aws-sdk-iotwireless-1.2.0 
Fetching: aws-sdk-kms-1.42.0.gem (100%) 
Successfully installed aws-sdk-kms-1.42.0 
Fetching: aws-sdk-kafka-1.34.0.gem (100%) 
Successfully installed aws-sdk-kafka-1.34.0 
Fetching: aws-sdk-kendra-1.21.0.gem (100%) 
Successfully installed aws-sdk-kendra-1.21.0 
Fetching: aws-sdk-kinesis-1.31.0.gem (100%) 
Successfully installed aws-sdk-kinesis-1.31.0 
Fetching: aws-sdk-kinesisanalytics-1.30.0.gem (100%) 
Successfully installed aws-sdk-kinesisanalytics-1.30.0 
Fetching: aws-sdk-kinesisanalyticsv2-1.25.0.gem (100%) 
Successfully installed aws-sdk-kinesisanalyticsv2-1.25.0 
Fetching: aws-sdk-kinesisvideo-1.31.0.gem (100%) 
Successfully installed aws-sdk-kinesisvideo-1.31.0 
Fetching: aws-sdk-kinesisvideoarchivedmedia-1.30.0.gem (100%) 
Successfully installed aws-sdk-kinesisvideoarchivedmedia-1.30.0 
Fetching: aws-sdk-kinesisvideomedia-1.27.0.gem (100%) 
Successfully installed aws-sdk-kinesisvideomedia-1.27.0 
Fetching: aws-sdk-kinesisvideosignalingchannels-1.9.0.gem (100%) 
Successfully installed aws-sdk-kinesisvideosignalingchannels-1.9.0 
Fetching: aws-sdk-lakeformation-1.12.0.gem (100%) 
Successfully installed aws-sdk-lakeformation-1.12.0 
Fetching: aws-sdk-lambda-1.59.0.gem (100%) 
Successfully installed aws-sdk-lambda-1.59.0 
Fetching: aws-sdk-lambdapreview-1.25.0.gem (100%) 
Successfully installed aws-sdk-lambdapreview-1.25.0 
Fetching: aws-sdk-lex-1.34.0.gem (100%) 
Successfully installed aws-sdk-lex-1.34.0 
Fetching: aws-sdk-lexmodelbuildingservice-1.43.0.gem (100%) 
Successfully installed aws-sdk-lexmodelbuildingservice-1.43.0 
Fetching: aws-sdk-lexmodelsv2-1.1.0.gem (100%) 
Successfully installed aws-sdk-lexmodelsv2-1.1.0 
Fetching: aws-sdk-lexruntimev2-1.1.0.gem (100%) 
Successfully installed aws-sdk-lexruntimev2-1.1.0 
Fetching: aws-sdk-licensemanager-1.24.0.gem (100%) 
Successfully installed aws-sdk-licensemanager-1.24.0 
Fetching: aws-sdk-lightsail-1.43.0.gem (100%) 
Successfully installed aws-sdk-lightsail-1.43.0 
Fetching: aws-sdk-locationservice-1.1.0.gem (100%) 
Successfully installed aws-sdk-locationservice-1.1.0 
Fetching: aws-sdk-lookoutforvision-1.1.0.gem (100%) 
Successfully installed aws-sdk-lookoutforvision-1.1.0 
Fetching: aws-sdk-mq-1.35.0.gem (100%) 
Successfully installed aws-sdk-mq-1.35.0 
Fetching: aws-sdk-mturk-1.28.0.gem (100%) 
Successfully installed aws-sdk-mturk-1.28.0 
Fetching: aws-sdk-mwaa-1.1.0.gem (100%) 
Successfully installed aws-sdk-mwaa-1.1.0 
Fetching: aws-sdk-machinelearning-1.26.0.gem (100%) 
Successfully installed aws-sdk-machinelearning-1.26.0 
Fetching: aws-sdk-macie-1.27.0.gem (100%) 
Successfully installed aws-sdk-macie-1.27.0 
Fetching: aws-sdk-macie2-1.22.0.gem (100%) 
Successfully installed aws-sdk-macie2-1.22.0 
Fetching: aws-sdk-managedblockchain-1.20.0.gem (100%) 
Successfully installed aws-sdk-managedblockchain-1.20.0 
Fetching: aws-sdk-marketplacecatalog-1.10.0.gem (100%) 
Successfully installed aws-sdk-marketplacecatalog-1.10.0 
Fetching: aws-sdk-marketplacecommerceanalytics-1.31.0.gem (100%) 
Successfully installed aws-sdk-marketplacecommerceanalytics-1.31.0 
Fetching: aws-sdk-marketplaceentitlementservice-1.25.0.gem (100%) 
Successfully installed aws-sdk-marketplaceentitlementservice-1.25.0 
Fetching: aws-sdk-marketplacemetering-1.33.0.gem (100%) 
Successfully installed aws-sdk-marketplacemetering-1.33.0 
Fetching: aws-sdk-mediaconnect-1.29.0.gem (100%) 
Successfully installed aws-sdk-mediaconnect-1.29.0 
Fetching: aws-sdk-mediaconvert-1.63.0.gem (100%) 
Successfully installed aws-sdk-mediaconvert-1.63.0 
Fetching: aws-sdk-medialive-1.63.0.gem (100%) 
Successfully installed aws-sdk-medialive-1.63.0 
Fetching: aws-sdk-mediapackage-1.37.0.gem (100%) 
Successfully installed aws-sdk-mediapackage-1.37.0 
Fetching: aws-sdk-mediapackagevod-1.20.0.gem (100%) 
Successfully installed aws-sdk-mediapackagevod-1.20.0 
Fetching: aws-sdk-mediastore-1.31.0.gem (100%) 
Successfully installed aws-sdk-mediastore-1.31.0 
Fetching: aws-sdk-mediastoredata-1.28.0.gem (100%) 
Successfully installed aws-sdk-mediastoredata-1.28.0 
Fetching: aws-sdk-mediatailor-1.34.0.gem (100%) 
Successfully installed aws-sdk-mediatailor-1.34.0 
Fetching: aws-sdk-migrationhub-1.30.0.gem (100%) 
Successfully installed aws-sdk-migrationhub-1.30.0 
Fetching: aws-sdk-migrationhubconfig-1.10.0.gem (100%) 
Successfully installed aws-sdk-migrationhubconfig-1.10.0 
Fetching: aws-sdk-mobile-1.25.0.gem (100%) 
Successfully installed aws-sdk-mobile-1.25.0 
Fetching: aws-sdk-neptune-1.33.0.gem (100%) 
Successfully installed aws-sdk-neptune-1.33.0 
Fetching: aws-sdk-networkfirewall-1.1.0.gem (100%) 
Successfully installed aws-sdk-networkfirewall-1.1.0 
Fetching: aws-sdk-networkmanager-1.10.0.gem (100%) 
Successfully installed aws-sdk-networkmanager-1.10.0 
Fetching: aws-sdk-opsworks-1.31.0.gem (100%) 
Successfully installed aws-sdk-opsworks-1.31.0 
Fetching: aws-sdk-opsworkscm-1.41.0.gem (100%) 
Successfully installed aws-sdk-opsworkscm-1.41.0 
Fetching: aws-sdk-organizations-1.57.0.gem (100%) 
Successfully installed aws-sdk-organizations-1.57.0 
Fetching: aws-sdk-outposts-1.14.0.gem (100%) 
Successfully installed aws-sdk-outposts-1.14.0 
Fetching: aws-sdk-pi-1.26.0.gem (100%) 
Successfully installed aws-sdk-pi-1.26.0 
Fetching: aws-sdk-personalize-1.21.0.gem (100%) 
Successfully installed aws-sdk-personalize-1.21.0 
Fetching: aws-sdk-personalizeevents-1.15.0.gem (100%) 
Successfully installed aws-sdk-personalizeevents-1.15.0 
Fetching: aws-sdk-personalizeruntime-1.21.0.gem (100%) 
Successfully installed aws-sdk-personalizeruntime-1.21.0 
Fetching: aws-sdk-pinpoint-1.49.0.gem (100%) 
Successfully installed aws-sdk-pinpoint-1.49.0 
Fetching: aws-sdk-pinpointemail-1.25.0.gem (100%) 
Successfully installed aws-sdk-pinpointemail-1.25.0 
Fetching: aws-sdk-pinpointsmsvoice-1.22.0.gem (100%) 
Successfully installed aws-sdk-pinpointsmsvoice-1.22.0 
Fetching: aws-sdk-polly-1.39.0.gem (100%) 
Successfully installed aws-sdk-polly-1.39.0 
Fetching: aws-sdk-pricing-1.25.0.gem (100%) 
Successfully installed aws-sdk-pricing-1.25.0 
Fetching: aws-sdk-prometheusservice-1.2.0.gem (100%) 
Successfully installed aws-sdk-prometheusservice-1.2.0 
Fetching: aws-sdk-qldb-1.12.0.gem (100%) 
Successfully installed aws-sdk-qldb-1.12.0 
Fetching: aws-sdk-qldbsession-1.12.0.gem (100%) 
Successfully installed aws-sdk-qldbsession-1.12.0 
Fetching: aws-sdk-quicksight-1.42.0.gem (100%) 
Successfully installed aws-sdk-quicksight-1.42.0 
Fetching: aws-sdk-ram-1.23.0.gem (100%) 
Successfully installed aws-sdk-ram-1.23.0 
Fetching: aws-sdk-rds-1.113.0.gem (100%) 
Successfully installed aws-sdk-rds-1.113.0 
Fetching: aws-sdk-rdsdataservice-1.24.0.gem (100%) 
Successfully installed aws-sdk-rdsdataservice-1.24.0 
Fetching: aws-sdk-redshift-1.54.0.gem (100%) 
Successfully installed aws-sdk-redshift-1.54.0 
Fetching: aws-sdk-redshiftdataapiservice-1.3.0.gem (100%) 
Successfully installed aws-sdk-redshiftdataapiservice-1.3.0 
Fetching: aws-sdk-rekognition-1.48.0.gem (100%) 
Successfully installed aws-sdk-rekognition-1.48.0 
Fetching: aws-sdk-resourcegroups-1.34.0.gem (100%) 
Successfully installed aws-sdk-resourcegroups-1.34.0 
Fetching: aws-sdk-resourcegroupstaggingapi-1.36.0.gem (100%) 
Successfully installed aws-sdk-resourcegroupstaggingapi-1.36.0 
Fetching: aws-sdk-robomaker-1.33.0.gem (100%) 
Successfully installed aws-sdk-robomaker-1.33.0 
Fetching: aws-sdk-route53-1.46.0.gem (100%) 
Successfully installed aws-sdk-route53-1.46.0 
Fetching: aws-sdk-route53domains-1.29.0.gem (100%) 
Successfully installed aws-sdk-route53domains-1.29.0 
Fetching: aws-sdk-route53resolver-1.23.0.gem (100%) 
Successfully installed aws-sdk-route53resolver-1.23.0 
Fetching: aws-sdk-s3-1.88.0.gem (100%) 
Successfully installed aws-sdk-s3-1.88.0 
Fetching: aws-sdk-s3control-1.27.0.gem (100%) 
Successfully installed aws-sdk-s3control-1.27.0 
Fetching: aws-sdk-s3outposts-1.1.0.gem (100%) 
Successfully installed aws-sdk-s3outposts-1.1.0 
Fetching: aws-sdk-ses-1.37.0.gem (100%) 
Successfully installed aws-sdk-ses-1.37.0 
Fetching: aws-sdk-sesv2-1.16.0.gem (100%) 
Successfully installed aws-sdk-sesv2-1.16.0 
Fetching: aws-sdk-sms-1.28.0.gem (100%) 
Successfully installed aws-sdk-sms-1.28.0 
Fetching: aws-sdk-sns-1.38.0.gem (100%) 
Successfully installed aws-sdk-sns-1.38.0 
Fetching: aws-sdk-sqs-1.36.0.gem (100%) 
Successfully installed aws-sdk-sqs-1.36.0 
Fetching: aws-sdk-ssm-1.104.0.gem (100%) 
Successfully installed aws-sdk-ssm-1.104.0 
Fetching: aws-sdk-ssoadmin-1.5.0.gem (100%) 
Successfully installed aws-sdk-ssoadmin-1.5.0 
Fetching: aws-sdk-ssooidc-1.9.0.gem (100%) 
Successfully installed aws-sdk-ssooidc-1.9.0 
Fetching: aws-sdk-swf-1.26.0.gem (100%) 
Successfully installed aws-sdk-swf-1.26.0 
Fetching: aws-sdk-sagemaker-1.77.0.gem (100%) 
Successfully installed aws-sdk-sagemaker-1.77.0 
Fetching: aws-sdk-sagemakerfeaturestoreruntime-1.1.0.gem (100%) 
Successfully installed aws-sdk-sagemakerfeaturestoreruntime-1.1.0 
Fetching: aws-sdk-sagemakerruntime-1.29.0.gem (100%) 
Successfully installed aws-sdk-sagemakerruntime-1.29.0 
Fetching: aws-sdk-sagemakeredgemanager-1.1.0.gem (100%) 
Successfully installed aws-sdk-sagemakeredgemanager-1.1.0 
Fetching: aws-sdk-savingsplans-1.13.0.gem (100%) 
Successfully installed aws-sdk-savingsplans-1.13.0 
Fetching: aws-sdk-schemas-1.11.0.gem (100%) 
Successfully installed aws-sdk-schemas-1.11.0 
Fetching: aws-sdk-secretsmanager-1.44.0.gem (100%) 
Successfully installed aws-sdk-secretsmanager-1.44.0 
Fetching: aws-sdk-securityhub-1.40.0.gem (100%) 
Successfully installed aws-sdk-securityhub-1.40.0 
Fetching: aws-sdk-serverlessapplicationrepository-1.33.0.gem (100%) 
Successfully installed aws-sdk-serverlessapplicationrepository-1.33.0 
Fetching: aws-sdk-servicecatalog-1.58.0.gem (100%) 
Successfully installed aws-sdk-servicecatalog-1.58.0 
Fetching: aws-sdk-servicediscovery-1.32.0.gem (100%) 
Successfully installed aws-sdk-servicediscovery-1.32.0 
Fetching: aws-sdk-servicequotas-1.13.0.gem (100%) 
Successfully installed aws-sdk-servicequotas-1.13.0 
Fetching: aws-sdk-shield-1.34.0.gem (100%) 
Successfully installed aws-sdk-shield-1.34.0 
Fetching: aws-sdk-signer-1.28.0.gem (100%) 
Successfully installed aws-sdk-signer-1.28.0 
Fetching: aws-sdk-simpledb-1.25.0.gem (100%) 
Successfully installed aws-sdk-simpledb-1.25.0 
Fetching: aws-sdk-snowball-1.36.0.gem (100%) 
Successfully installed aws-sdk-snowball-1.36.0 
Fetching: aws-sdk-states-1.38.0.gem (100%) 
Successfully installed aws-sdk-states-1.38.0 
Fetching: aws-sdk-storagegateway-1.53.0.gem (100%) 
Successfully installed aws-sdk-storagegateway-1.53.0 
Fetching: aws-sdk-support-1.29.0.gem (100%) 
Successfully installed aws-sdk-support-1.29.0 
Fetching: aws-sdk-synthetics-1.11.0.gem (100%) 
Successfully installed aws-sdk-synthetics-1.11.0 
Fetching: aws-sdk-textract-1.23.0.gem (100%) 
Successfully installed aws-sdk-textract-1.23.0 
Fetching: aws-sdk-timestreamquery-1.3.0.gem (100%) 
Successfully installed aws-sdk-timestreamquery-1.3.0 
Fetching: aws-sdk-timestreamwrite-1.3.0.gem (100%) 
Successfully installed aws-sdk-timestreamwrite-1.3.0 
Fetching: aws-sdk-transcribeservice-1.51.0.gem (100%) 
Successfully installed aws-sdk-transcribeservice-1.51.0 
Fetching: aws-sdk-transcribestreamingservice-1.26.0.gem (100%) 
Successfully installed aws-sdk-transcribestreamingservice-1.26.0 
Fetching: aws-sdk-transfer-1.30.0.gem (100%) 
Successfully installed aws-sdk-transfer-1.30.0 
Fetching: aws-sdk-translate-1.30.0.gem (100%) 
Successfully installed aws-sdk-translate-1.30.0 
Fetching: aws-sdk-waf-1.37.0.gem (100%) 
Successfully installed aws-sdk-waf-1.37.0 
Fetching: aws-sdk-wafregional-1.38.0.gem (100%) 
Successfully installed aws-sdk-wafregional-1.38.0 
Fetching: aws-sdk-wafv2-1.15.0.gem (100%) 
Successfully installed aws-sdk-wafv2-1.15.0 
Fetching: aws-sdk-wellarchitected-1.2.0.gem (100%) 
Successfully installed aws-sdk-wellarchitected-1.2.0 
Fetching: aws-sdk-workdocs-1.29.0.gem (100%) 
Successfully installed aws-sdk-workdocs-1.29.0 
Fetching: aws-sdk-worklink-1.22.0.gem (100%) 
Successfully installed aws-sdk-worklink-1.22.0 
Fetching: aws-sdk-workmail-1.35.0.gem (100%) 
Successfully installed aws-sdk-workmail-1.35.0 
Fetching: aws-sdk-workmailmessageflow-1.10.0.gem (100%) 
Successfully installed aws-sdk-workmailmessageflow-1.10.0 
Fetching: aws-sdk-workspaces-1.50.0.gem (100%) 
Successfully installed aws-sdk-workspaces-1.50.0 
Fetching: aws-sdk-xray-1.36.0.gem (100%) 
Successfully installed aws-sdk-xray-1.36.0 
Fetching: aws-sdk-resources-3.94.0.gem (100%) 
Successfully installed aws-sdk-resources-3.94.0 
Fetching: aws-sdk-3.0.1.gem (100%) 
Successfully installed aws-sdk-3.0.1 
266 gems installed 
[root@test01 ~]# 

 

 

 

■gem コマンドでインストールしたバージョンの確認

[root@test01 work]# gem list 
 
*** LOCAL GEMS *** 
 
aws-eventstream (1.1.0) 
aws-partitions (1.426.0) 
aws-sdk (3.0.1) ← aws-sdk 3.0.1 
aws-sdk-accessanalyzer (1.16.0) 
aws-sdk-acm (1.39.0) 
aws-sdk-acmpca (1.33.0) 
aws-sdk-alexaforbusiness (1.44.0) 
aws-sdk-amplify (1.28.0) 
aws-sdk-amplifybackend (1.2.0) 
aws-sdk-apigateway (1.59.0) 
aws-sdk-apigatewaymanagementapi (1.20.0) 
aws-sdk-apigatewayv2 (1.31.0) 
aws-sdk-appconfig (1.13.0) 
aws-sdk-appflow (1.6.0) 
aws-sdk-appintegrationsservice (1.1.0) 
aws-sdk-applicationautoscaling (1.50.0) 
aws-sdk-applicationdiscoveryservice (1.34.0) 
aws-sdk-applicationinsights (1.17.0) 
aws-sdk-appmesh (1.34.0) 
aws-sdk-appregistry (1.4.0) 
aws-sdk-appstream (1.50.0) 
aws-sdk-appsync (1.38.0) 
aws-sdk-athena (1.35.0) 
aws-sdk-auditmanager (1.3.0) 
aws-sdk-augmentedairuntime (1.11.0) 
aws-sdk-autoscaling (1.54.0) 
aws-sdk-autoscalingplans (1.30.0) 
aws-sdk-backup (1.27.0) 
aws-sdk-batch (1.44.0) 
aws-sdk-braket (1.6.0) 
aws-sdk-budgets (1.37.0) 
aws-sdk-chime (1.41.0) 
aws-sdk-cloud9 (1.30.0) 
aws-sdk-clouddirectory (1.30.0) 
aws-sdk-cloudformation (1.47.0) 
aws-sdk-cloudfront (1.48.0) 
aws-sdk-cloudhsm (1.28.0) 
aws-sdk-cloudhsmv2 (1.32.0) 
aws-sdk-cloudsearch (1.28.0) 
aws-sdk-cloudsearchdomain (1.23.0) 
aws-sdk-cloudtrail (1.33.0) 
aws-sdk-cloudwatch (1.49.0) 
aws-sdk-cloudwatchevents (1.41.0) 
aws-sdk-cloudwatchlogs (1.39.0) 
aws-sdk-codeartifact (1.7.0) 
aws-sdk-codebuild (1.67.0) 
aws-sdk-codecommit (1.41.0) 
aws-sdk-codedeploy (1.38.0) 
aws-sdk-codeguruprofiler (1.13.0) 
aws-sdk-codegurureviewer (1.15.0) 
aws-sdk-codepipeline (1.40.0) 
aws-sdk-codestar (1.28.0) 
aws-sdk-codestarconnections (1.13.0) 
aws-sdk-codestarnotifications (1.9.0) 
aws-sdk-cognitoidentity (1.30.0) 
aws-sdk-cognitoidentityprovider (1.49.0) 
aws-sdk-cognitosync (1.25.0) 
aws-sdk-comprehend (1.43.0) 
aws-sdk-comprehendmedical (1.24.0) 
aws-sdk-computeoptimizer (1.13.0) 
aws-sdk-configservice (1.56.0) 
aws-sdk-connect (1.40.0) 
aws-sdk-connectcontactlens (1.1.0) 
aws-sdk-connectparticipant (1.10.0) 
aws-sdk-core (3.112.0) 
aws-sdk-costandusagereportservice (1.29.0) 
aws-sdk-costexplorer (1.58.0) 
aws-sdk-customerprofiles (1.3.0) 
aws-sdk-databasemigrationservice (1.51.0) 
aws-sdk-dataexchange (1.12.0) 
aws-sdk-datapipeline (1.25.0) 
aws-sdk-datasync (1.29.0) 
aws-sdk-dax (1.28.0) 
aws-sdk-detective (1.12.0) 
aws-sdk-devicefarm (1.40.0) 
aws-sdk-devopsguru (1.3.0) 
aws-sdk-directconnect (1.38.0) 
aws-sdk-directoryservice (1.38.0) 
aws-sdk-dlm (1.39.0) 
aws-sdk-docdb (1.28.0) 
aws-sdk-dynamodb (1.59.0) 
aws-sdk-dynamodbstreams (1.28.0) 
aws-sdk-ebs (1.12.0) 
aws-sdk-ec2 (1.224.0) 
aws-sdk-ec2instanceconnect (1.12.0) 
aws-sdk-ecr (1.41.0) 
aws-sdk-ecrpublic (1.1.0) 
aws-sdk-ecs (1.74.0) 
aws-sdk-efs (1.37.0) 
aws-sdk-eks (1.47.0) 
aws-sdk-elasticache (1.53.0) 
aws-sdk-elasticbeanstalk (1.41.0) 
aws-sdk-elasticinference (1.11.0) 
aws-sdk-elasticloadbalancing (1.30.0) 
aws-sdk-elasticloadbalancingv2 (1.59.0) 
aws-sdk-elasticsearchservice (1.48.0) 
aws-sdk-elastictranscoder (1.28.0) 
aws-sdk-emr (1.41.0) 
aws-sdk-emrcontainers (1.2.0) 
aws-sdk-eventbridge (1.19.0) 
aws-sdk-firehose (1.36.0) 
aws-sdk-fms (1.34.0) 
aws-sdk-forecastqueryservice (1.11.0) 
aws-sdk-forecastservice (1.15.0) 
aws-sdk-frauddetector (1.16.0) 
aws-sdk-fsx (1.34.0) 
aws-sdk-gamelift (1.41.0) 
aws-sdk-glacier (1.36.0) 
aws-sdk-globalaccelerator (1.29.0) 
aws-sdk-glue (1.83.0) 
aws-sdk-gluedatabrew (1.4.0) 
aws-sdk-greengrass (1.38.0) 
aws-sdk-greengrassv2 (1.2.0) 
aws-sdk-groundstation (1.16.0) 
aws-sdk-guardduty (1.44.0) 
aws-sdk-health (1.32.0) 
aws-sdk-healthlake (1.2.0) 
aws-sdk-honeycode (1.5.0) 
aws-sdk-iam (1.47.0) 
aws-sdk-identitystore (1.4.0) 
aws-sdk-imagebuilder (1.18.0) 
aws-sdk-importexport (1.25.0) 
aws-sdk-inspector (1.33.0) 
aws-sdk-iot (1.66.0) 
aws-sdk-iot1clickdevicesservice (1.27.0) 
aws-sdk-iot1clickprojects (1.27.0) 
aws-sdk-iotanalytics (1.37.0) 
aws-sdk-iotdataplane (1.27.0) 
aws-sdk-iotdeviceadvisor (1.1.0) 
aws-sdk-iotevents (1.21.0) 
aws-sdk-ioteventsdata (1.14.0) 
aws-sdk-iotfleethub (1.1.0) 
aws-sdk-iotjobsdataplane (1.26.0) 
aws-sdk-iotsecuretunneling (1.10.0) 
aws-sdk-iotsitewise (1.19.0) 
aws-sdk-iotthingsgraph (1.13.0) 
aws-sdk-iotwireless (1.2.0) 
aws-sdk-ivs (1.7.0) 
aws-sdk-kafka (1.34.0) 
aws-sdk-kendra (1.21.0) 
aws-sdk-kinesis (1.31.0) 
aws-sdk-kinesisanalytics (1.30.0) 
aws-sdk-kinesisanalyticsv2 (1.25.0) 
aws-sdk-kinesisvideo (1.31.0) 
aws-sdk-kinesisvideoarchivedmedia (1.30.0) 
aws-sdk-kinesisvideomedia (1.27.0) 
aws-sdk-kinesisvideosignalingchannels (1.9.0) 
aws-sdk-kms (1.42.0) 
aws-sdk-lakeformation (1.12.0) 
aws-sdk-lambda (1.59.0) 
aws-sdk-lambdapreview (1.25.0) 
aws-sdk-lex (1.34.0) 
aws-sdk-lexmodelbuildingservice (1.43.0) 
aws-sdk-lexmodelsv2 (1.1.0) 
aws-sdk-lexruntimev2 (1.1.0) 
aws-sdk-licensemanager (1.24.0) 
aws-sdk-lightsail (1.43.0) 
aws-sdk-locationservice (1.1.0) 
aws-sdk-lookoutforvision (1.1.0) 
aws-sdk-machinelearning (1.26.0) 
aws-sdk-macie (1.27.0) 
aws-sdk-macie2 (1.22.0) 
aws-sdk-managedblockchain (1.20.0) 
aws-sdk-marketplacecatalog (1.10.0) 
aws-sdk-marketplacecommerceanalytics (1.31.0) 
aws-sdk-marketplaceentitlementservice (1.25.0) 
aws-sdk-marketplacemetering (1.33.0) 
aws-sdk-mediaconnect (1.29.0) 
aws-sdk-mediaconvert (1.63.0) 
aws-sdk-medialive (1.63.0) 
aws-sdk-mediapackage (1.37.0) 
aws-sdk-mediapackagevod (1.20.0) 
aws-sdk-mediastore (1.31.0) 
aws-sdk-mediastoredata (1.28.0) 
aws-sdk-mediatailor (1.34.0) 
aws-sdk-migrationhub (1.30.0) 
aws-sdk-migrationhubconfig (1.10.0) 
aws-sdk-mobile (1.25.0) 
aws-sdk-mq (1.35.0) 
aws-sdk-mturk (1.28.0) 
aws-sdk-mwaa (1.1.0) 
aws-sdk-neptune (1.33.0) 
aws-sdk-networkfirewall (1.1.0) 
aws-sdk-networkmanager (1.10.0) 
aws-sdk-opsworks (1.31.0) 
aws-sdk-opsworkscm (1.41.0) 
aws-sdk-organizations (1.57.0) 
aws-sdk-outposts (1.14.0) 
aws-sdk-personalize (1.21.0) 
aws-sdk-personalizeevents (1.15.0) 
aws-sdk-personalizeruntime (1.21.0) 
aws-sdk-pi (1.26.0) 
aws-sdk-pinpoint (1.49.0) 
aws-sdk-pinpointemail (1.25.0) 
aws-sdk-pinpointsmsvoice (1.22.0) 
aws-sdk-polly (1.39.0) 
aws-sdk-pricing (1.25.0) 
aws-sdk-prometheusservice (1.2.0) 
aws-sdk-qldb (1.12.0) 
aws-sdk-qldbsession (1.12.0) 
aws-sdk-quicksight (1.42.0) 
aws-sdk-ram (1.23.0) 
aws-sdk-rds (1.113.0) 
aws-sdk-rdsdataservice (1.24.0) 
aws-sdk-redshift (1.54.0) 
aws-sdk-redshiftdataapiservice (1.3.0) 
aws-sdk-rekognition (1.48.0) 
aws-sdk-resourcegroups (1.34.0) 
aws-sdk-resourcegroupstaggingapi (1.36.0) 
aws-sdk-resources (3.94.0) 
aws-sdk-robomaker (1.33.0) 
aws-sdk-route53 (1.46.0) 
aws-sdk-route53domains (1.29.0) 
aws-sdk-route53resolver (1.23.0) 
aws-sdk-s3 (1.88.0) 
aws-sdk-s3control (1.27.0) 
aws-sdk-s3outposts (1.1.0) 
aws-sdk-sagemaker (1.77.0) 
aws-sdk-sagemakeredgemanager (1.1.0) 
aws-sdk-sagemakerfeaturestoreruntime (1.1.0) 
aws-sdk-sagemakerruntime (1.29.0) 
aws-sdk-savingsplans (1.13.0) 
aws-sdk-schemas (1.11.0) 
aws-sdk-secretsmanager (1.44.0) 
aws-sdk-securityhub (1.40.0) 
aws-sdk-serverlessapplicationrepository (1.33.0) 
aws-sdk-servicecatalog (1.58.0) 
aws-sdk-servicediscovery (1.32.0) 
aws-sdk-servicequotas (1.13.0) 
aws-sdk-ses (1.37.0) 
aws-sdk-sesv2 (1.16.0) 
aws-sdk-shield (1.34.0) 
aws-sdk-signer (1.28.0) 
aws-sdk-simpledb (1.25.0) 
aws-sdk-sms (1.28.0) 
aws-sdk-snowball (1.36.0) 
aws-sdk-sns (1.38.0) 
aws-sdk-sqs (1.36.0) 
aws-sdk-ssm (1.104.0) 
aws-sdk-ssoadmin (1.5.0) 
aws-sdk-ssooidc (1.9.0) 
aws-sdk-states (1.38.0) 
aws-sdk-storagegateway (1.53.0) 
aws-sdk-support (1.29.0) 
aws-sdk-swf (1.26.0) 
aws-sdk-synthetics (1.11.0) 
aws-sdk-textract (1.23.0) 
aws-sdk-timestreamquery (1.3.0) 
aws-sdk-timestreamwrite (1.3.0) 
aws-sdk-transcribeservice (1.51.0) 
aws-sdk-transcribestreamingservice (1.26.0) 
aws-sdk-transfer (1.30.0) 
aws-sdk-translate (1.30.0) 
aws-sdk-waf (1.37.0) 
aws-sdk-wafregional (1.38.0) 
aws-sdk-wafv2 (1.15.0) 
aws-sdk-wellarchitected (1.2.0) 
aws-sdk-workdocs (1.29.0) 
aws-sdk-worklink (1.22.0) 
aws-sdk-workmail (1.35.0) 
aws-sdk-workmailmessageflow (1.10.0) 
aws-sdk-workspaces (1.50.0) 
aws-sdk-xray (1.36.0) 
aws-sigv2 (1.0.1) 
aws-sigv4 (1.2.2) 
bigdecimal (1.3.4) 
cmath (default: 1.0.0) 
csv (default: 1.0.0) 
date (default: 1.0.0) 
dbm (default: 1.0.0) 
did_you_mean (1.2.0) 
etc (default: 1.0.0) 
fcntl (default: 1.0.0) 
fiddle (default: 1.0.0) 
fileutils (default: 1.0.2) 
gdbm (default: 2.0.0) 
io-console (0.4.6) 
ipaddr (default: 1.2.0) 
jmespath (1.4.0) 
json (2.1.0) 
openssl (2.1.2) 
psych (3.0.2) 
rdoc (6.0.1) 
scanf (default: 1.0.0) 
sdbm (default: 1.0.0) 
stringio (default: 0.0.1) 
strscan (default: 1.0.0) 
webrick (default: 1.4.2) 
zlib (default: 1.0.0) 
[root@test01 work]# 

 

 

 

AWS SDKの動作確認

AWS SDK の動作確認をします。

 

■AWS SDKの動作確認

[root@test01 ~]# ruby -e "require 'rubygems';require 'aws-sdk';AWS::CloudWatch.new.client.describe_alarms" 
Traceback (most recent call last): 
-e:1:in `

': uninitialized constant AWS (NameError) 
Did you mean?  Aws 
[root@test01 ~]# 

 

エラーが出ましたが、上記構文はバージョンが古いことによるエラーなので、最新バージョン(aws-sdk 3.0.1 )の構文で記載しなおします。

 

 

■AWS SDKの動作確認(最新バージョン 3.0.1)

[root@test01 work]# sudo ruby -e "require 'rubygems';require 'aws-sdk';Aws::CloudWatch::Client.new(region: 'eu-west-2')" 

 

 

 

 

 

Ruby のプログラム

CloudWatch のメトリクスを取得する Ruby のプログラムを作成します。

 

EC2 インスタンスの CPUUtilization を取得する

最初に EC2 インスタンスの CPUUtilization を取得するプログラムです。

 

■Ruby のプログラム(バージョン 3 用)

[root@test01 ~]# vi cloudwatch01 
require 'aws-sdk' 
 
Aws.config.update( 
    region: 'ap-northeast-1', 
    credentials: Aws::Credentials.new('アクセスキー入力', 'シークレットアクセスキー入力') 
    ) 
 
metric = Aws::CloudWatch::Metric.new('AWS/EC2', 'CPUUtilization') 
 
result = metric.get_statistics(:start_time => Time.now - 24 * 60 * 60, 
                           :end_time => Time.now, 
                           :statistics => ['Average'], 
                           :period => 300, ←  CloudWatchのデフォルトのデータ取得期間は 5 分なので 300(秒)に設定します。
                           :dimensions=>[{:name=>"InstanceId", :value=>"インスタンスID"}]) 
 
result.each{|datapoint| 
  p datapoint 
}  

 

 

 

■プログラムの実行結果

[root@test01 ~]# ruby cloudwatch01 
CPUUtilization 
[#<struct Aws::CloudWatch::Types::Datapoint timestamp=2021-02-12 11:37:00 UTC, sample_count=nil, average=0.10001852366397979, sum=nil, minimum=nil, maximum=nil, unit="Percent", extended_statistics={}>, #<struct Aws::CloudWatch::Types::Datapoint timestamp=2021-02-12 07:12:00 UTC, sample_count=nil, average=0.099489702934207, sum=nil, minimum=nil, maximum=nil, unit="Percent", extended_statistics={}>, 

 

~ 省略 ~

 

#<struct Aws::CloudWatch::Types::Datapoint timestamp=2021-02-12 04:57:00 UTC, sample_count=nil, average=0.16617489326485538, sum=nil, minimum=nil, maximum=nil, unit="Percent", extended_statistics={}>, #<struct Aws::CloudWatch::Types::Datapoint timestamp=2021-02-12 04:22:00 UTC, sample_count=nil, average=0.0994535519125698, sum=nil, minimum=nil, maximum=nil, unit="Percent", extended_statistics={}>, #<struct Aws::CloudWatch::Types::Datapoint timestamp=2021-02-12 03:47:00 UTC, sample_count=nil, average=0.1333518569973148, sum=nil, minimum=nil, maximum=nil, unit="Percent", extended_statistics={}>, #<struct Aws::CloudWatch::Types::Datapoint timestamp=2021-02-12 03:12:00 UTC, sample_count=nil, average=0.1011494252873566, sum=nil, minimum=nil, maximum=nil, unit="Percent", extended_statistics={}>, #<struct Aws::CloudWatch::Types::Datapoint timestamp=2021-02-12 02:37:00 UTC, sample_count=nil, average=0.1333880080189544, sum=nil, minimum=nil, maximum=nil, unit="Percent", extended_statistics={}>] 
[root@test01 ~]# 

 

 

※もし値がうまく取得できなかった場合は、時間の設定が短すぎる可能性があるので調整します。

 

 

■プログラムの実行結果

成形すると以下のようになります。

[root@test01 ~]# ruby cloudwatch01 
CPUUtilization 

#<struct Aws::CloudWatch::Types::Datapoint timestamp=2021-02-12 11:37:00 UTC, sample_count=nil, average=0.10001852366397979, sum=nil, minimum=nil, maximum=nil, unit="Percent", extended_statistics={}>,  
#<struct Aws::CloudWatch::Types::Datapoint timestamp=2021-02-12 07:12:00 UTC, sample_count=nil, average=0.099489702934207, sum=nil, minimum=nil, maximum=nil, unit="Percent", extended_statistics={}>,  
#<struct Aws::CloudWatch::Types::Datapoint timestamp=2021-02-12 02:47:00 UTC, sample_count=nil, average=0.10056497175141259, sum=nil, minimum=nil, maximum=nil, unit="Percent", extended_statistics={}>,  
#<struct Aws::CloudWatch::Types::Datapoint timestamp=2021-02-12 09:17:00 UTC, sample_count=nil, average=0.1333518569973136, sum=nil, minimum=nil, maximum=nil, unit="Percent", extended_statistics={}>,  

 

~ 省略 ~

#<struct Aws::CloudWatch::Types::Datapoint timestamp=2021-02-12 03:17:00 UTC, sample_count=nil, average=0.1333518569973136, sum=nil, minimum=nil, maximum=nil, unit="Percent", extended_statistics={}>,  
#<struct Aws::CloudWatch::Types::Datapoint timestamp=2021-02-12 09:47:00 UTC, sample_count=nil, average=0.10060297719992621, sum=nil, minimum=nil, maximum=nil, unit="Percent", extended_statistics={}>,  
#<struct Aws::CloudWatch::Types::Datapoint timestamp=2021-02-12 05:22:00 UTC, sample_count=nil, average=0.10112994350282381, sum=nil, minimum=nil, maximum=nil, unit="Percent", extended_statistics={}>,  
#<struct Aws::CloudWatch::Types::Datapoint timestamp=2021-02-12 00:57:00 UTC, sample_count=nil, average=0.13225896082245142, sum=nil, minimum=nil, maximum=nil, unit="Percent", extended_statistics={}>,  
#<struct Aws::CloudWatch::Types::Datapoint timestamp=2021-02-12 07:27:00 UTC, sample_count=nil, average=0.1333333333333328, sum=nil, minimum=nil, maximum=nil, unit="Percent", extended_statistics={}>,  
#<struct Aws::CloudWatch::Types::Datapoint timestamp=2021-02-12 03:02:00 UTC, sample_count=nil, average=0.10001852366397979, sum=nil, minimum=nil, maximum=nil, unit="Percent", extended_statistics={}>,  
#<struct Aws::CloudWatch::Types::Datapoint timestamp=2021-02-12 09:32:00 UTC, sample_count=nil, average=0.133351856997316, sum=nil, minimum=nil, maximum=nil, unit="Percent", extended_statistics={}>,  
#<struct Aws::CloudWatch::Types::Datapoint timestamp=2021-02-12 05:07:00 UTC, sample_count=nil, average=0.1005649717514114, sum=nil, minimum=nil, maximum=nil, unit="Percent", extended_statistics={}>] 
[root@test01 ~]# 

 

 

 

■Ruby のプログラム(バージョン 3 用)(時間を短く調整)

require 'aws-sdk' 
 
Aws.config.update( 
    region: 'ap-northeast-1', 
    credentials: Aws::Credentials.new('アクセスキー入力', 'シークレットアクセスキー入力') 
    ) 
 
metric = Aws::CloudWatch::Metric.new('AWS/EC2', 'CPUUtilization') 
 
result = metric.get_statistics({ 
    dimensions: [ 
        { 
            name: "InstanceId", 
            value: "インスタンスID", 
        } 
    ], 
    start_time: Time.now - 600, ← 時間が短すぎると値が取得できないので注意。 
    end_time: Time.now, 
    period: 300, 
    statistics: ["Maximum"] 
}) 
 
result.each{|datapoint| 
  p datapoint 

 

 

 

■プログラムの実行結果

[root@test01 ~]# ruby cloudwatch01 
CPUUtilization 

#<struct Aws::CloudWatch::Types::Datapoint timestamp=2021-02-12 11:37:00 UTC, sample_count=nil, average=0.10001852366397979, sum=nil, minimum=nil, maximum=nil, unit="Percent", extended_statistics={}>] 
[root@test01 ~]# 

 

 

 

 

 

RDS の CPUUtilization を取得する

 

■RDS の CPUUtilization を取得するプログラム(Maximumの場合)

[root@test01 ~]# vi cloudwatch03 
require 'aws-sdk' 
 
Aws.config.update( 
    region: 'ap-northeast-1', 
    credentials: Aws::Credentials.new('アクセスキー入力','シークレットアクセスキー入力') 
    ) 
 
metric = Aws::CloudWatch::Metric.new('AWS/RDS', 'CPUUtilization') 
 
result = metric.get_statistics({ 
    dimensions: [ 
        { 
            name: "DBInstanceIdentifier", 
            value: "test-rds-01", 
        } 
    ], 
    start_time: Time.now - 300, 
    end_time: Time.now, 
    period: 60, 
    statistics: ["Maximum"] 
}) 
 
result.each{|datapoint| 
  p datapoint 

[root@test01 ~]# 

 

 

 

■プログラムの実行結果

[root@test01 ~]# ruby cloudwatch03 
CPUUtilization 

#<struct Aws::CloudWatch::Types::Datapoint timestamp=2021-02-12 16:02:00 UTC, sample_count=nil, average=nil, sum=nil, minimum=nil, maximum=0.0, unit="Percent", extended_statistics={}>,  
#<struct Aws::CloudWatch::Types::Datapoint timestamp=2021-02-12 16:03:00 UTC, sample_count=nil, average=nil, sum=nil, minimum=nil, maximum=0.0, unit="Percent", extended_statistics={}>,  
#<struct Aws::CloudWatch::Types::Datapoint timestamp=2021-02-12 16:04:00 UTC, sample_count=nil, average=nil, sum=nil, minimum=nil, maximum=3.0, unit="Percent", extended_statistics={}>,  
#<struct Aws::CloudWatch::Types::Datapoint timestamp=2021-02-12 16:05:00 UTC, sample_count=nil, average=nil, sum=nil, minimum=nil, maximum=0.0, unit="Percent", extended_statistics={}>,  
#<struct Aws::CloudWatch::Types::Datapoint timestamp=2021-02-12 16:06:00 UTC, sample_count=nil, average=nil, sum=nil, minimum=nil, maximum=0.0, unit="Percent", extended_statistics={}>] 
[root@test01 ~]# 

 

 

 

 

 

■RDS の CPUUtilization を取得するプログラム(Averageの場合)

require 'aws-sdk' 
 
Aws.config.update( 
    region: 'ap-northeast-1', 
    credentials: Aws::Credentials.new('アクセスキー入力','シークレットアクセスキー入力') 
    ) 
 
metric = Aws::CloudWatch::Metric.new('AWS/RDS', 'CPUUtilization') 
 
result = metric.get_statistics({ 
    dimensions: [ 
        { 
            name: "DBInstanceIdentifier", 
            value: "test-rds-01", 
        } 
    ], 
    start_time: Time.now - 60, 
    end_time: Time.now, 
    period: 60, 
    statistics: ["Average"] 
}) 
 
result.each{|datapoint| 
  p datapoint 

 

 

 

■プログラムの実行結果

[root@test01 ~]# ruby cloudwatch03 
CPUUtilization 
[#<struct Aws::CloudWatch::Types::Datapoint timestamp=2021-02-12 16:12:00 UTC, sample_count=nil, average=1.0, sum=nil, minimum=nil, maximum=nil, unit="Percent", extended_statistics={}>] 
[root@test01 ~]# 

 

 

 

 

 

 

Posted by 100%レンタルサーバーを使いこなすサイト管理人

コメントを残す

メールアドレスが公開されることはありません。 * が付いている欄は必須項目です

AlphaOmega Captcha Medica  –  What Do You See?
     
 

このサイトはスパムを低減するために Akismet を使っています。コメントデータの処理方法の詳細はこちらをご覧ください

Secured By miniOrange