반응형
테라폼: 우분투 20.08 LTS AWS에 특화된 AMI 목록
문제: 나는 특정 OS의 AMI 목록을 얻기 위해 테라폼을 사용하고 있다 - 우분투 20.08
다른 예를 확인했습니다
스크립트를 사용할 때 AMI 목록이 표시되지 않습니다
대본
data "aws_ami" "ubuntu" {
most_recent = true
filter {
name = "name"
values = ["ubuntu/images/hvm-ssd/ubuntu-xenial-20.08-amd64-server-*"]
}
filter {
name = "virtualization - type"
values = ["hvm"]
}
owners = ["AWS"]
}
아래 링크도 참고했습니다
출력:
[ec2-user@ip-172-31-84-148 ~]$ terraform plan
provider.aws.region
The region where AWS operations will take place. Examples
are us-east-1, us-west-2, etc.
Enter a value: us-east-1
Refreshing Terraform state in-memory prior to plan...
The refreshed state will be used to calculate this plan, but will not be
persisted to local or remote state storage.
data.aws_ami.std_ami: Refreshing state...
------------------------------------------------------------------------
No changes. Infrastructure is up-to-date.
This means that Terraform did not detect any differences between your configuration and real physical resources that exist. As a result, no actions need to be performed.
나는 내가 어디에서 잘못되고 있는지 모르겠다. 나는 내가 아래에 나열한 많은 링크를 확인했다.
데이터는 다음과 같습니다:
data "aws_ami" "ubuntu" {
most_recent = true
filter {
name = "name"
values = ["ubuntu/images/hvm-ssd/ubuntu-focal-20.04-amd64-server-*"]
}
filter {
name = "virtualization-type"
values = ["hvm"]
}
owners = ["099720109477"]
}
output "test" {
value = data.aws_ami.ubuntu
}
Ubuntu의 소유자는 AWS가 아니며 이미지는 not입니다.
위의 결과는 ()로 나타난다:
{
"architecture" = "x86_64"
"arn" = "arn:aws:ec2:us-east-1::image/ami-0dba2cb6798deb6d8"
"block_device_mappings" = [
{
"device_name" = "/dev/sda1"
"ebs" = {
"delete_on_termination" = "true"
"encrypted" = "false"
"iops" = "0"
"snapshot_id" = "snap-0f06f1549ff7327c9"
"volume_size" = "8"
"volume_type" = "gp2"
}
"no_device" = ""
"virtual_name" = ""
},
{
"device_name" = "/dev/sdb"
"ebs" = {}
"no_device" = ""
"virtual_name" = "ephemeral0"
},
{
"device_name" = "/dev/sdc"
"ebs" = {}
"no_device" = ""
"virtual_name" = "ephemeral1"
},
]
"creation_date" = "2020-09-08T00:55:25.000Z"
"description" = "Canonical, Ubuntu, 20.04 LTS, amd64 focal image build on 2020-09-07"
"filter" = [
{
"name" = "name"
"values" = [
"ubuntu/images/hvm-ssd/ubuntu-focal-20.04-amd64-server-*",
]
},
{
"name" = "virtualization-type"
"values" = [
"hvm",
]
},
]
"hypervisor" = "xen"
"id" = "ami-0dba2cb6798deb6d8"
"image_id" = "ami-0dba2cb6798deb6d8"
"image_location" = "099720109477/ubuntu/images/hvm-ssd/ubuntu-focal-20.04-amd64-server-20200907"
"image_type" = "machine"
"most_recent" = true
"name" = "ubuntu/images/hvm-ssd/ubuntu-focal-20.04-amd64-server-20200907"
"owner_id" = "099720109477"
"owners" = [
"099720109477",
]
"product_codes" = []
"public" = true
"root_device_name" = "/dev/sda1"
"root_device_type" = "ebs"
"root_snapshot_id" = "snap-0f06f1549ff7327c9"
"sriov_net_support" = "simple"
"state" = "available"
"state_reason" = {
"code" = "UNSET"
"message" = "UNSET"
}
"tags" = {}
"virtualization_type" = "hvm"
}
나에게 맞는 방법은 "아마존"을 주인으로 사용하는 것이다. 그렇지 않으면 소유자로서 099720109477을 사용하면 요금이 발생합니다
data "aws_ami" "ubuntu22" {
most_recent = true
owners = ["amazon"]
filter {
name = "name"
values = ["ubuntu/images/hvm-ssd/ubuntu-jammy-22.04-amd64-*"]
}
filter {
name = "virtualization-type"
values = ["hvm"]
}
}
반응형
'개발하자' 카테고리의 다른 글
마크다운을 사용하여 주피터 노트북의 목차에 네스트된 주문 목록을 만들 수 있나요? (0) | 2023.08.07 |
---|---|
주피터 오류: "jupyter_core.paths라는 이름의 모듈이 없습니다." (0) | 2023.08.06 |
텍스트 필드의 플러터 커서가 설정 상태 후 위치 0으로 이동합니다 (0) | 2023.08.05 |
svelte에서 비동기 대기(#await)를 사용하면 나중 함수 호출에서 형식화된 원하는 데이터가 반환되지 않습니다 (0) | 2023.08.05 |
쿠버네티스의 변화 원인 (0) | 2023.08.04 |