如何从AWS参数存储中导出参数并导入到另一个帐户 [英] How to export parameters from aws parameter store and import into another account

查看:96
本文介绍了如何从AWS参数存储中导出参数并导入到另一个帐户的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的第一个 AWS帐户上,我以以下方式指定了参数:

on my first aws account I have parameters specified in the following manner:

/config/a => value1
/config/b => value2
/config/c/a => value31
/config/c/b => value32

我想将它们转移到我的 second aws帐户.

I want to move these to my second aws account.

我在参数存储区中手动创建了这些参数.

I created these parameters in the parameter store manually.

我如何轻松地将这些值从一个帐户复制到另一个帐户?

How could I easily copy these values from one account to the other?

使用aws ssm get-parameters --names "<param-name>"会有点困难,因为我有太多的参数.

Using aws ssm get-parameters --names "<param-name>" would be a bit too difficult, since I have way too many parameters.

推荐答案

  1. 通过aws ssm get-parameters-by-path --path "/relative/path/" --recursive
  2. 检索所有参数
  3. 将生成的JSON向下写入-例如进入文件
  4. 准备放置命令,例如JS
  1. Retrieve all parameters via aws ssm get-parameters-by-path --path "/relative/path/" --recursive
  2. Write the resulting JSON somewhere down - e.g. into a file
  3. Prepare put commands e.g. with JS

for (const value of params.Parameters) {
    const { Name, Value } = value;
    console.log(`aws ssm put-parameter --name "${Name}" --value "${Value}" --type "String"`);
}

这篇关于如何从AWS参数存储中导出参数并导入到另一个帐户的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆