Difference between revisions of "Terraform data source: aws ami"

From wikieduonline
Jump to navigation Jump to search
Line 110: Line 110:
 
* <code>[[data.aws_ami]].your_ubuntu.id</code>
 
* <code>[[data.aws_ami]].your_ubuntu.id</code>
 
* [[Kinetic]]
 
* [[Kinetic]]
 +
* [[data.aws_ami.ubuntu.id]]
  
 
== See also ==
 
== See also ==

Revision as of 11:26, 25 October 2024

 values = ["ubuntu/images/hvm-ssd-gp3/ubuntu-noble-24.04-amd64-server-*"]
 values = ["ubuntu/images/hvm-ssd/ubuntu-*-23.04-amd64-server-*"]
 values = ["ubuntu/images/hvm-ssd/ubuntu-kinetic-22.10-amd64-server-*"]
 values = ["ubuntu/images/hvm-ssd/ubuntu-jammy-22.04-amd64-server-*"]



data "aws_ami" "my_ubuntu" {
  most_recent = true

  filter {
    name   = "name"
    values = ["ubuntu/images/hvm-ssd/ubuntu-*-23.04-amd64-server-*"]
  } 

  filter {
    name   = "virtualization-type"
    values = ["hvm"]
  } 

  owners = ["099720109477"] # Canonical
}
data "aws_ami" "my_ubuntu" {
  most_recent = true

  filter {
    name   = "name"
    values = ["ubuntu/images/hvm-ssd/ubuntu-jammy-22.04-amd64-server-*"]
  } 

  filter {
    name   = "virtualization-type"
    values = ["hvm"]
  } 

  owners = ["099720109477"] # Canonical
}


data "aws_ami" "my_ubuntu" {
  most_recent = true

  filter {
    name   = "name"
    values = ["ubuntu/images/hvm-ssd/ubuntu-hirsute-21.04-amd64-server-*"]
  } 

  filter {
    name   = "virtualization-type"
    values = ["hvm"]
  } 

  owners = ["099720109477"] # Canonical
}



data "aws_ami" "amzlinux2" {
  most_recent = true
  owners      = ["amazon"]
 
  filter {
    name   = "name"
    values = ["amzn2-ami-hvm-*-x86_64-ebs"]
  }
}


RHEL

https://dev.to/drewmullen/terraform-boilerplate-common-awsami-searches-5hcg

data "aws_ami" "rhel_7" {
 most_recent = true
 owners      = ["309956199498"]

 filter {
   name = "name"
   values = ["RHEL-7.9_HVM_GA*-x86_64-0-Hourly2-GP2"]
 }
}

ECS

data "aws_ami" "ecs_ami" {
 most_recent = true
 owners      = ["591542846629"]

 filter {
   name   = "name"
   values = ["amzn2-ami-ecs-*"]
 }

 filter {
   name   = "architecture"
   values = ["x86_64"]
 }

 filter {
   name   = "virtualization-type"
   values = ["hvm"]
 }
}

Owners

Related

See also

Advertising: