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

DescribeVpcEndpointConnections is returning empty reponse #995

Closed
gowrisankar22 opened this issue Dec 22, 2020 · 10 comments
Closed

DescribeVpcEndpointConnections is returning empty reponse #995

gowrisankar22 opened this issue Dec 22, 2020 · 10 comments
Labels
closing-soon This issue will automatically close in 4 days unless further comments are made. guidance Question that needs advice or information.

Comments

@gowrisankar22
Copy link

gowrisankar22 commented Dec 22, 2020

Hello All,

I am trying to use the DescribeVpcEndpointConnections[1][2] to list all the available vpc endpoints but it is not returning the values. Looks like an issue?

but aws cli is working fine using aws ec2 describe-vpc-endpoints

Response:

VPC endpoint: Details:
{
	"NextToken": null,
	"VpcEndpointConnections": [],
	"ResultMetadata": {}
}

DescribeVpcEndpointConnections

package main

import (
	"context"
	"encoding/json"
	"fmt"

	"github.com/aws/aws-sdk-go-v2/config"
	"github.com/aws/aws-sdk-go-v2/service/ec2"
)

func main() {
	cfg, err := config.LoadDefaultConfig(context.TODO(),
		config.WithRegion("eu-central-1"),
	)
	if err != nil {
		panic(fmt.Sprintf("failed loading config, %v", err))
	}

	client := ec2.NewFromConfig(cfg)

	input := &ec2.DescribeVpcEndpointConnectionsInput{}

	resp, err := client.DescribeVpcEndpointConnections(context.Background(), input)

	if err != nil {
		fmt.Println("Got an error retrieving information about your VPC endpoint:")
		fmt.Println(err)
		return
	}

	fmt.Println("VPC endpoint: Details:")
	respDecrypted, _ := json.MarshalIndent(resp, "", "\t")
	fmt.Println(string(respDecrypted))
}

[1] https://pkg.go.dev/github.com/aws/aws-sdk-go-v2/service/ec2#DescribeVpcEndpointConnectionsInput
[2] https://pkg.go.dev/github.com/aws/aws-sdk-go-v2/service/ec2#DescribeVpcEndpointConnections

@gowrisankar22 gowrisankar22 added the bug This issue is a bug. label Dec 22, 2020
@jasdel
Copy link
Contributor

jasdel commented Dec 22, 2020

Thanks for reporting this issue @gowrisankar22 I think this is related to the fix in #992 . The SDK was incorrectly deserializing XML document responses.

@gowrisankar22
Copy link
Author

gowrisankar22 commented Dec 22, 2020

@jasdel what is the tentative timeline for the next release with this fix? our development blocked due to this issue ?

@gowrisankar22 gowrisankar22 changed the title DescribeVpcEndpointConnections is not returning empty reponse DescribeVpcEndpointConnections is returning empty reponse Dec 22, 2020
@gowrisankar22
Copy link
Author

gowrisankar22 commented Dec 24, 2020

@jasdel @skmcgrail I have tried with v0.31 but still, the issue not yet fixed.

the same was working fine with version v0.29

@skmcgrail
Copy link
Member

skmcgrail commented Dec 24, 2020

I am not able to replicate this behavior on v0.31.0. I created a VPC Endpoint Service in the console, attached the endpoint to a VPC and was able to use the code you provided to get a response from the service describing the endpoint connections.

Can you please enable response logging following the logging guide to confirm that you are getting an expected response from the service?

@gowrisankar22
Copy link
Author

@skmcgrail I have added the logger but I don't see any logs but it looks strange for me ..

I am using go version go1.15.6 darwin/amd64.

var applicationLogger logging.Logger
cfg, err := config.LoadDefaultConfig(context.TODO(), config.WithLogger(applicationLogger))

@skmcgrail
Copy link
Member

You will also need to pass config.WithClientLogMode(aws.LogResponseWithBody) to LoadDefaultConfig to enable the logging of the response body.

@gowrisankar22
Copy link
Author

gowrisankar22 commented Dec 25, 2020

@skmcgrail
I have received the below response. I didn't find any event in the cloud trail as well.

SDK 2020/12/25 08:20:58 DEBUG Response
HTTP/1.1 200 OK
Transfer-Encoding: chunked
Cache-Control: no-cache, no-store
Content-Type: text/xml;charset=UTF-8
Date: Fri, 25 Dec 2020 02:50:58 GMT
Server: AmazonEC2
Strict-Transport-Security: max-age=31536000; includeSubDomains
Vary: accept-encoding
X-Amzn-Requestid: 889ec0b3-197f-4aff-8a62-8a7e9332e1f6

10a
<?xml version="1.0" encoding="UTF-8"?>
<DescribeVpcEndpointConnectionsResponse xmlns="http://ec2.amazonaws.com/doc/2016-11-15/">
    <requestId>889ec0b3-197f-4aff-8a62-8a7e9332e1f6</requestId>
    <vpcEndpointConnectionSet/>
</DescribeVpcEndpointConnectionsResponse>
0

VPC endpoint: Details:
{
	"NextToken": null,
	"VpcEndpointConnections": [],
	"ResultMetadata": {}
}

@skmcgrail
Copy link
Member

As indicated by the output of the raw HTTP response, the service is returning you no items as indicated by <vpcEndpointConnectionSet/>. Please confirm that you are using the correct API, from my testing and understanding, this API only returns connections details to VPC Endpoints (AWS PrivateLink) for services hosted by you in your account, or another AWS customer account. This API does not include details for PrivateLink connections provided by AWS services like EC2 or DynamoDB. See the AWS PrivateLink and VPC endpoints user guide.

@skmcgrail skmcgrail added guidance Question that needs advice or information. closing-soon This issue will automatically close in 4 days unless further comments are made. and removed bug This issue is a bug. labels Jan 4, 2021
@gowrisankar22
Copy link
Author

gowrisankar22 commented Jan 5, 2021

@skmcgrail thanks :) It was my mistake. I got the right api and it is working now :)
https://github.com/aws/aws-sdk-go-v2/blob/service/ec2/v0.31.0/service/ec2/api_op_DescribeVpcEndpoints.go#L32

@github-actions
Copy link

github-actions bot commented Jan 5, 2021

⚠️COMMENT VISIBILITY WARNING⚠️

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
closing-soon This issue will automatically close in 4 days unless further comments are made. guidance Question that needs advice or information.
Projects
None yet
Development

No branches or pull requests

3 participants