如何将AMI从一个AWS帐户复制到另一个AWS帐户? [英] how to copy AMI from one aws account to other aws account?
问题描述
Am正在尝试使用打包程序将自定义内置的ami从一个AWS账户复制到另一个AWS账户;但是,我能够在一个帐户中跨区域复制ami.
Am trying to copy the custom built ami using packer from one AWS account to another AWS account; however, i was able to copy ami across regions within one account.
"builders":[{"account_id":"12345678910","s3_bucket":"xyz/xqas/asd","x509_cert_path":"/Users/txyz/packer/certificate.pem","x509_key_path":"/Users/txyz/packer/private-key.pem","type":"amazon-instance","access_key":"{{user
access_key }}","secret_key":"{{user
secret_key }}","region":"us-east-1","source_ami":"ami-452bd728","instance_type":"r3.xlarge","ssh_username":"ubuntu","ami_name":"packer-test-hvm {{timestamp}}","ami_virtualization_type":"hvm","force_deregister":是的,"ami_regions":["us-east-1","us-west-2"]}],
"builders": [{
"account_id": "12345678910",
"s3_bucket": "xyz/xqas/asd",
"x509_cert_path": "/Users/txyz/packer/certificate.pem",
"x509_key_path": "/Users/txyz/packer/private-key.pem",
"type": "amazon-instance",
"access_key": "{{user
access_key}}",
"secret_key": "{{user
secret_key}}",
"region": "us-east-1",
"source_ami": "ami-452bd728",
"instance_type": "r3.xlarge",
"ssh_username": "ubuntu",
"ami_name": "packer-test-hvm {{timestamp}}",
"ami_virtualization_type": "hvm",
"force_deregister": true,
"ami_regions": ["us-east-1", "us-west-2"]
}],
推荐答案
使用AWS ClI并在需要传输的AMI中运行以下命令
Use AWS ClI and run the following command in the AMI that needs to be transferred
ec2-modify-image-attribute ami-2bb65342 -l -a 111122223333
有关其他可用选项,请参阅本指南
For other options that are available please refer this guide
http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/sharingamis-explicit.html
这篇关于如何将AMI从一个AWS帐户复制到另一个AWS帐户?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!