我正在使用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:ap-southeast-2: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)
但是它抛出错误,例如无效的文档:跨区域的arn不支持。
我该如何解决?
反正有没有使该软件包受到所有AWS帐户的支持?
SSM文档可以是shared across accounts。
但是,此错误不是跨帐户错误。它是指您将SSM文档从一个区域引用到另一区域。
由于客户端和实例位于ap-southeast-2
中,而文档位于us-east-1
中,因此您需要在ap-southeast-2
区域中创建文档。