Hey, team! I'm trying to achieve the following: - ...
# getting-started
t
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
Copy code
# 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
you can poll the instance inside an apply, but pulumi already blocks until the instance is running.
t
@billowy-army-68599, I actually see this (screenshot), although
pulumi up
has finished executing
Copy code
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
ah, then using an apply is the answer
i can throw an example together later
t
that would be awesome! thanks so much 🙂
super helpful
b
t
thanks @billowy-army-68599 - you unblocked me