Skip to content
This repository has been archived by the owner. It is now read-only.

Add GetPasswordData operation for EC2 instances #244

Open
wants to merge 1 commit into
base: master
from

Conversation

@jen20
Copy link

jen20 commented Mar 21, 2015

Description

This operation allows the user to obtain a copy of the auto-generated Administrator password for an instance running Windows, encrypted using the key-pair specified on instance launch.

A test has been added using the example from the documentation, but with the response updated to reflect the actual time format passed in current usage.

Example usage

package main

import (
    "fmt"
    "github.com/mitchellh/goamz/aws"
    "github.com/mitchellh/goamz/ec2"
    "log"
)

func main() {
    auth, err := aws.EnvAuth()
    if err != nil {
        log.Fatal(err)
    }

    client := ec2.New(auth, aws.USEast)

    resp, err := client.GetPasswordData("i-7435208e")
    if err != nil {
        log.Fatal(err)
    }

    log.Print(fmt.Sprintf("%+v", resp))
}

Example output (password available):

015/03/21 12:42:50 &{RequestId:ae0976ec-bf3e-4f29-8b76-b2909b53b55a InstanceId:i-7435208e Timestamp:2015-03-21 16:39:38 +0000 UTC PasswordData:
c1jbhR3b7cApaiPX2X8BdqqGo0LlY3jsFL5ods3yrp86UXhznv1Ae3rlNjxAKVFJOCGcbnDkV1dWU1CkOrc1proiWKJVefQsNXSKfVf/GW5eq+jag0C2jG2LITeKoio8jovhVMqQvtxP+DC+p21XWfBwXAuF5shAG+ULvx6dj1/7HJuDdcJwkptEswvIg95HOyfx29h6gTMDx1JwEHGDasWTJzrUp7tGESl+6LPS7SRI5SlrE1RrNn/3tsJstBi5yLKb7MjKlCHf6FNJYrlt1eXcA3gSAeBB699UjhXv1M5x6SSqmVmLcNlPeFfoOBbZ8vKS458p7Zj00OF3GJvGpA==
}

Example output (password not yet available):

2015/03/21 12:39:09 &{RequestId:a3df9040-beae-413c-862d-7833eb5de5e7 InstanceId:i-7435208e Timestamp:2015-03-21 16:38:16 +0000 UTC PasswordData:}
This operation allows the user to obtain a copy of the auto-generated
Administrator password for an instance running Windows, encrypted using
the key-pair specified on instance launch.
@jen20
Copy link
Author

jen20 commented Apr 2, 2015

@mitchellh Is this likely to be accepted given the new libs? packer-community/packer-windows-plugins#39 depends on it - I can likely work around this if necessary though.

@mefellows
Copy link

mefellows commented May 23, 2015

Hi @mitchellh, is this likely to be merged anytime soon? Looking to follow up on the above PR for Packer Windows Plugins. If not, we'll work on another strategy.

@davidvasandani
Copy link

davidvasandani commented Sep 22, 2015

+1

@jen20
Copy link
Author

jen20 commented Sep 22, 2015

You can now do this with the official AWS SDK:

resp, err := ec2conn.GetPasswordData(&ec2.GetPasswordDataInput{
    InstanceId: aws.String("instanceId"),
})
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

4 participants
You can’t perform that action at this time.