· 6 years ago · Aug 29, 2019, 09:46 AM
1AWS CLI : aws ec2 describe-images --filters Name=name,Values=ubuntu*
2
3Output:
4
5{
6 "Images": [
7 {
8 "EnaSupport": true,
9 "Architecture": "x86_64",
10 "VirtualizationType": "hvm",
11 "ImageType": "machine",
12 "OwnerId": "099720109477",
13 "ImageId": "ami-0000fa2aab9835382",
14 "Name": "ubuntu-minimal/images-testing/hvm-ssd/ubuntu-disco-daily-amd64-minimal-20181216",
15 "CreationDate": "2018-12-16T07:45:06.000Z",
16 "State": "available",
17 "Hypervisor": "xen",
18 "Public": true,
19 "BlockDeviceMappings": [
20 {
21 "DeviceName": "/dev/sda1",
22 "Ebs": {
23 "VolumeType": "gp2",
24 "DeleteOnTermination": true,
25 "SnapshotId": "snap-028e0d907e19233e9",
26 "VolumeSize": 8,
27 "Encrypted": false
28 }
29 },
30 {
31 "DeviceName": "/dev/sdb",
32 "VirtualName": "ephemeral0"
33 },
34 {
35 "DeviceName": "/dev/sdc",
36 "VirtualName": "ephemeral1"
37 }
38 ],
39 "RootDeviceName": "/dev/sda1",
40 "Description": "Canonical, Ubuntu Minimal, 19.04, UNSUPPORTED daily amd64 disco image build on 2018-12-16",
41 "RootDeviceType": "ebs",
42 "ImageLocation": "099720109477/ubuntu-minimal/images-testing/hvm-ssd/ubuntu-disco-daily-amd64-minimal-20181216",
43 "SriovNetSupport": "simple"
44 },
45 {
46 },
47 {
48 }
49
50 ]
51
52
53 Terrafrom Data Source "aws_ami:
54
55
56provider "aws" {
57 access_key = "xxxxx"
58 secret_key = "xxxxx"
59 region = "us-east-2"
60 }
61
62data "aws_ami" "ubuntu_ami" {
63 most_recent = true
64 owners = ["099720109477"]
65
66 filter {
67 name = "name"
68 values = ["ubuntu/*"]
69 }
70}