```import pulumi import pulumi_aws as aws size = ...
# getting-started
g
Copy code
import pulumi
import pulumi_aws as aws

size = 't2.micro'
ami = aws.get_ami(most_recent="true",
                  owners=["137112412989"],
                  filters=[{"name":"name","values":["amzn-ami-hvm-*"]}])

group = aws.ec2.SecurityGroup('webserver-secgrp',
    description='Enable HTTP access',
    ingress=[
        { 'protocol': 'tcp', 'from_port': 22, 'to_port': 22, 'cidr_blocks': ['0.0.0.0/0'] }
    ])

server = aws.ec2.Instance('webserver-www',
    instance_type=size,
    vpc_security_group_ids=[group.id], # reference security group from above
    ami=ami.id)

pulumi.export('publicIp', server.public_ip)
pulumi.export('publicHostName', server.public_dns)
Is there a list of such aliases for AMIs "amzn-ami-hvm-*"? If I want to use Ubuntu Server 20.04 LTS (HVM) instead of Amazon Linux 2 AMI (HVM).
b
hey there! there's no aliases for this no, it's a string lookup in the Amazon interface, and there are thousands of AMIs available. You'd be best to search for your preferred AMI
l
Also, using the AWS CLI command
ec2 describe images
can help you drill down on AMIs available by owner. See https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/finding-an-ami.html for more info on how to construct your command.
👍 1
There’s even an example showing how to retrieve Ubuntu 16.04 AMIs for you to base yours off of