i am new packer and exploring few things on it while using it something like this came up
"builders": [
{
"type": "amazon-ebs",
"profile" : "sumanthdev",
"region": "us-east-1",
"source_ami_filter": {
"filters": {
"virtualization-type": "hvm",
"name": "ubuntu/images/*ubuntu-xenial-16.04-amd64-server-*",
"root-device-type": "ebs"
},
"owners": ["099720109477"],
"most_recent": true
},
I want to know what "owners": ["099720109477"], stands for. i know it takes input of an account id, but which? the account id where it going to create the ami, or?
This is to filter the AMIs, for those that are owned by a specific AWS account. In this case this filter will only find images owned by the account id of 099720109477
that are named ubuntu/images/*ubuntu-xenial-16.04-amd64-server-*
.
Below from the documentation
Filters the images by their owner. You may specify one or more AWS account IDs, "self" (which will use the account whose credentials you are using to run Packer), or an AWS owner alias: for example, amazon, aws-marketplace, or microsoft. This option is required for security reasons.
"099720109477 is the account number for Canonical." Source . (The comment below that one is also quite useful.)
Note that owners
is also an optional parameter .
You may be looking for the ami_users
field in order to share the AMI across accounts. ami_users
is not a parameter in the source_ami_filter
but instead can be found in the top-level of the source
body, like so:
source "amazon-ebs" "dev-latest" {
ami_name = "dev-latest-${local.timestamp}"
instance_type = "t2.micro"
region = var.region
source_ami_filter {
filters = {
image-id = "ami-03d5c68bab01f3496"
root-device-type = "ebs"
virtualization-type = "hvm"
}
most_recent = true
owners = ["099720109477"]
}
ssh_username = "ubuntu"
ami_users = ["777777777777", "888888888888", "999999999999"]
}
owners
own the base AMI (layer) of the AMI you are making. ami_users
are account numbers that the completed image is shared with. After the AMI is "Available", you'll see output (at least with packer) that indicates it is modifying the privacy attributes of the completed image.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.