https://pulumi.com logo
Title
t

thousands-balloon-4359

05/18/2023, 5:48 PM
Hey, team! I'm trying to achieve the following: • create ec2 instances • essentially have
pulumi up
block till the instance is
running
I have the Pulumi python starter template - is there some docs/examples I can look at to achieve this? Is the appropriate way to keep polling till the system reaches the desired state? potentially relevant reference to what got generated after
pulumi new
# Create and launch an EC2 instance into the public subnet.
server = aws.ec2.Instance("server",
    instance_type=instance_type,
    subnet_id=subnet.id,
    vpc_security_group_ids=[sec_group.id],
    user_data=user_data,
    ami=ami,
    tags={
        "Name": "webserver",
    })
b

billowy-army-68599

05/18/2023, 5:55 PM
you can poll the instance inside an apply, but pulumi already blocks until the instance is running.
t

thousands-balloon-4359

05/18/2023, 6:07 PM
@billowy-army-68599, I actually see this (screenshot), although
pulumi up
has finished executing
Do you want to perform this update? yes
Updating (pulumi-local):
     Type                              Name                      Status              
 +   pulumi:pulumi:Stack               ec2-vm-demo-pulumi-local  created (38s)       
 +   ├─ aws:ec2:Vpc                    vpc                       created (12s)       
 +   ├─ aws:ec2:InternetGateway        gateway                   created (0.82s)     
 +   ├─ aws:ec2:Subnet                 subnet                    created (11s)       
 +   ├─ aws:ec2:SecurityGroup          secGroup                  created (2s)        
 +   ├─ aws:ec2:RouteTable             routeTable                created (1s)        
 +   ├─ aws:ec2:RouteTableAssociation  routeTableAssociation     created (0.66s)     
 +   └─ aws:ec2:Instance               server                    created (13s)       


Outputs:
    hostname: "<http://ec2-54-204-51-222.compute-1.amazonaws.com|ec2-54-204-51-222.compute-1.amazonaws.com>"
    ip      : "54.204.51.222"
    url     : "<http://ec2-54-204-51-222.compute-1.amazonaws.com>"

Resources:
    + 8 created

Duration: 40s
the "status check" component is something I'm interested in (because the resource isn't super usable till that turns green, although technically speaking, the resource is "running")
b

billowy-army-68599

05/18/2023, 6:10 PM
ah, then using an apply is the answer
i can throw an example together later
t

thousands-balloon-4359

05/18/2023, 6:13 PM
that would be awesome! thanks so much 🙂
super helpful
b

billowy-army-68599

05/18/2023, 7:11 PM
t

thousands-balloon-4359

05/19/2023, 5:14 AM
thanks @billowy-army-68599 - you unblocked me