【问题标题】:How to make SSM Document shared between all AWS accounts?如何在所有 AWS 账户之间共享 SSM 文档?
【发布时间】:2020-09-25 11:15:17
【问题描述】:

我正在使用 AWS 系统管理器。我正在使用它来使用系统管理器下的分发器将我的软件推送到实例。

分销商创建一个包。该包将包含我的安装脚本,卸载脚本和我要推送的.exe文件。整个包将保存为由系统管理员维护的SSM文档。

假设我有两个 AWS 账户,我的问题:

一个帐户 - 我创建包的帐户(us-east-1)

B 帐户 - 正在运行的实例。(ap-southeast-2

我想将'A'中的包推送到帐户'B'实例。

我必须用我的 python 代码来做这个。所以我使用了 boto3。

 def runcommand(self,instanceid):
        try:
            response = self.ssmclient.send_command(
                InstanceIds=[instanceid,],
                DocumentName='AWS-ConfigureAWSPackage',
                TimeoutSeconds=600,
                Parameters={
                    'action': ['Install'],
                    'installationType':['Uninstall and reinstall'],
                    'name':['arn:aws:ssm:us-east-1:accnumber:document/SSMDistributorPackage']
                },
                OutputS3Region='ap-southeast-2',
                OutputS3BucketName='output',
                OutputS3KeyPrefix='abcd',
            )
            print("Successfully pushed the agent....")
        except Exception as e:
            print("The error while running command:::::",str(e))
        print("response(send_command)::::",response)

但它会抛出类似 Invalid Document:cross region arn is not support 之类的错误。

我该如何解决这个问题?

有没有办法让所有 aws 帐户都支持这个包?

【问题讨论】:

    标签: amazon-web-services amazon-s3 boto3 aws-systems-manager


    【解决方案1】:

    SSM 文档可以是shared across accounts

    但是,此错误不是跨帐户错误。它是您将 SSM 文档从一个区域引用到另一个区域。

    由于客户端和实例位于ap-southeast-2,但文档位于us-east-1,您需要在ap-southeast-2 区域中创建文档。

    【讨论】:

    • 我已将文档权限类型修改为共享。但我不知道为什么会抛出此警报
    • 你的ssm客户端是哪个地区的?
    • 在悉尼地区
    • 有没有其他方法可以在 AWS 中解决这个问题?我想将我的软件推送到实例
    • 感谢mokugo-devops的回复和建议。我会试试的
    猜你喜欢
    • 2021-10-09
    • 1970-01-01
    • 1970-01-01
    • 2015-11-24
    • 1970-01-01
    • 2020-09-07
    • 1970-01-01
    • 2015-02-24
    • 1970-01-01
    相关资源
    最近更新 更多