LoginSignup
1
0

More than 5 years have passed since last update.

AWS RDS パラメータグループをPowerShellで設定する

Posted at

はじめに

Edit-RDSDBParameterGroupのヘルプには変更するパラメータの指定が
-Parameter <Amazon.RDS.Model.Parameter[]>
と書かれているが、ここってどう書けばいいの?
という人向け。

コード

このサンプルでは
パラメータグループファミリー:aurora-mysql5.7
タイプ:DB Parameter Group
で作成したパラメータグループを変更しようとしています。

パラメータ決め打ち

パラメータが変動しないのであればParameterの初期化で入れてしまうこの書き方で良いと思う。


$SplattingParameter = @{
  DBParameterGroupName = "sampleparametergroup";
  Parameter            = (
    @{
      ParameterName  = "default_tmp_storage_engine";
      ParameterValue = "MyISAM";
      ApplyMethod    = "pending-reboot";
    },
    @{
      ParameterName  = "binlog_cache_size";
      ParameterValue = 65535;
      ApplyMethod    = "pending-reboot";
    }
  );
  Region               = "us-east-1"
}
Edit-RDSDBParameterGroup @SplattingParameter

パラメータ変動

何かの仕組みの中に組み込み、変更するパラメータが増減するならこの書き方。
この例では無条件で入れていますが$ParameterArrayに追加する前に条件分岐したり、
ループの中に組み込んでも良いでしょう。

$ParameterArray = @()

$ParameterArray += @{
  ParameterName  = "default_tmp_storage_engine";
  ParameterValue = "MyISAM";
  ApplyMethod    = "pending-reboot";
}

$ParameterArray += @{
  ParameterName  = "binlog_cache_size";
  ParameterValue = 65535;
  ApplyMethod    = "pending-reboot";
}

$SplattingParameter = @{
  DBParameterGroupName = "sampleparametergroup";
  Parameter            = $ParameterArray;
  Region               = "us-east-1"
}

Edit-RDSDBParameterGroup @SplattingParameter
1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0