Thread
#aws
    s

    strong-helmet-83704

    1 month ago
    Is there any way to have Pulumi capture the output of UserData code which runs on instance boot?
    b

    billowy-army-68599

    1 month ago
    can you elaborate on what you mean by this?
    s

    strong-helmet-83704

    1 month ago
    I am running UserData code. This code generates some shell output. I’m wondering if this output could be exposed/accessed by Pulumi? The object returned from ec2.Instance does have a user_data field but this seems to be encoded.
    b

    billowy-army-68599

    1 month ago
    it’s base64 encoded, decode it
    s

    strong-helmet-83704

    1 month ago
    I did already try that but got gibberish
    I suspect that might be the encoded input rather than the output
    m

    miniature-musician-31262

    1 month ago
    I suspect that might be the encoded input rather than the output
    Correct — that field is just what you put in, not what comes out.
    I believe if you want to capture the output of a script that runs on instance create, you’d want the Command provider: https://www.pulumi.com/registry/packages/command/
    s

    strong-helmet-83704

    1 month ago
    Awesome! This is exactly what i was looking for. thanks @miniature-musician-31262
    m

    miniature-musician-31262

    1 month ago
    You bet!
    s

    strong-helmet-83704

    1 month ago
    This looks great for a direct connection to a host. Does it support a jump-box / bastion? (perhaps that could be handled in an ssh-config file somewhere)
    m

    miniature-musician-31262

    1 month ago
    I don’t think there’s anything built-in that handles indirect connections like this for you — at least not yet.
    s

    strong-helmet-83704

    1 month ago
    You’re correct. I did some very funky stuff to jump to the next box. It’s not pretty tho. Wouldn’t be hard to extend this module/package to include the -J (or arbitrary) ssh options