问题
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": true,
"ami_regions": ["us-east-1", "us-west-2"]
}],
回答1:
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
来源:https://stackoverflow.com/questions/37734683/how-to-copy-ami-from-one-aws-account-to-other-aws-account