Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ec2.WaitUntilPasswordDataAvailableWithContext never works (always returns ResourceNotReady) #2865

Closed
3 tasks done
barri2gi opened this issue Jul 13, 2020 · 4 comments
Closed
3 tasks done
Assignees
Labels
feature-request A feature should be added or improved. service-api This issue is due to a problem in a service API, not the SDK implementation.

Comments

@barri2gi
Copy link

Confirm by changing [ ] to [x] below to ensure that it's a bug:

Describe the bug
Calling ec2.WaitUntilPasswordDataAvailableWithContext always exceeds the timeout and returns ResourceNotReady, even when the instance's password data is ready and available

Version of AWS SDK for Go?
v1.33.5

Version of Go (go version)?
go1.14.2 darwin/amd64

To Reproduce (observed behavior)

  1. Launch a new Windows EC2 t2.micro instance in the us-east-1 region, providing a key-pair. I used AMI ID ami-05bb2dae0b1de90b3. Wait until the instance is running and verify its password data is available in the AWS Management Console via the "Connect" button, then the "Get Password" button.

  2. Run the following code

package main

import (
	"github.com/aws/aws-sdk-go/aws"
	"github.com/aws/aws-sdk-go/aws/awserr"
	"github.com/aws/aws-sdk-go/aws/request"
	"github.com/aws/aws-sdk-go/aws/session"
	"github.com/aws/aws-sdk-go/service/ec2"
	"os"

	"fmt"
)

func main() {

	// Initialize a session in us-east-1 that the SDK will use to load
	// credentials from the shared credentials file ~/.aws/credentials.
	session, _ := session.NewSession(aws.NewConfig().WithRegion("us-east-1"))
	ec2Client := ec2.New(session)

	// Verify the password data is available and start a waiter to test that functionality
	instanceId := "i-019ca9f16bb7d5b0e"
	passwordDataInputRequest := &ec2.GetPasswordDataInput{
		InstanceId: aws.String(instanceId),
	}
	getPasswordDataOutput, _ := ec2Client.GetPasswordData(passwordDataInputRequest)
	if len(*getPasswordDataOutput.PasswordData) > 0 {
		fmt.Printf("password data is ready for %s. starting waiter to test that functionality...\n", instanceId)
		ctx := aws.BackgroundContext()
		err := ec2Client.WaitUntilPasswordDataAvailableWithContext(ctx, passwordDataInputRequest, request.WithWaiterMaxAttempts(5))
		if err != nil {
			aerr, ok := err.(awserr.Error)
			if ok && aerr.Code() == request.WaiterResourceNotReadyErrorCode {
				fmt.Fprintf(os.Stderr, "timed out while waiting for password data to become available for %s\n", instanceId)
			}
			panic(fmt.Errorf("failed to wait for password data to become available for %s:\n%v", instanceId, err))
		}
	}
}

Expected behavior
I expect the waiter to return almost immediately, as it's clear the instance's password data does exist.

Additional context
Nothing to add

@diehlaws diehlaws self-assigned this Aug 3, 2020
@diehlaws
Copy link
Contributor

diehlaws commented Aug 3, 2020

Thanks for bringing this to our attention @barri2gi. I'm able to reproduce the described behavior - issuing a GetPasswordData call for an instance that has password data available elicits a successful response from the service, however WaitUntilPasswordDataAvailable times out on the same instance despite the HTTP response from the service including the expected PasswordData field. We're looking into this behavior and will update the issue once we have additional information.

@diehlaws diehlaws removed their assignment Aug 26, 2020
@skmcgrail skmcgrail transferred this issue from aws/aws-sdk-go Mar 26, 2021
@ajredniwja ajredniwja added feature-request A feature should be added or improved. service-api This issue is due to a problem in a service API, not the SDK implementation. labels May 3, 2021
@stobrien89 stobrien89 removed the service-api This issue is due to a problem in a service API, not the SDK implementation. label Jul 26, 2021
@stobrien89
Copy link
Member

Created a separate ticket to request replacement of existing waiter: P51806969

@tim-finnigan tim-finnigan added the service-api This issue is due to a problem in a service API, not the SDK implementation. label Jun 9, 2022
@vudh1 vudh1 self-assigned this Jun 9, 2022
@vudh1 vudh1 assigned RanVaknin and unassigned vudh1 Sep 9, 2022
@RanVaknin RanVaknin assigned indrora and unassigned RanVaknin Sep 25, 2023
@RanVaknin RanVaknin assigned debora-ito and unassigned indrora Mar 1, 2024
@zshzbh zshzbh transferred this issue from aws/aws-sdk Oct 30, 2024
@lucix-aws
Copy link
Contributor

aws/aws-sdk-go#5270

@lucix-aws lucix-aws closed this as not planned Won't fix, can't repro, duplicate, stale Oct 30, 2024
Copy link

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

@zshzbh zshzbh transferred this issue from aws/aws-sdk-go Oct 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request A feature should be added or improved. service-api This issue is due to a problem in a service API, not the SDK implementation.
Projects
None yet
Development

No branches or pull requests

10 participants