aws-sdk-go-v2 icon indicating copy to clipboard operation
aws-sdk-go-v2 copied to clipboard

503 error (api error Unavailable: The service is unavailable) when trying to create VpcEndpoint on new VpcEndpointService

Open Tyzanol opened this issue 2 years ago • 9 comments

Describe the bug

We are using the aws go sdk v2 (ec2) package to create a VpcEndoint. I we are working on a new VpcEndpointService, We encounter an a 503 error stating that the VpcEndpointService isn't ready yet. We tried checking the serviceState of the VpcEndpointService but we get 'ServiceStateAvailable' promptly after the creation. With that said - we are still receiving the 503 errors when trying to create the VpcEndpoint.

Is there any way to check that the service is ready before creating the VpcEndpoint?

Expected Behavior

Once creating the VpcEndpointService, I don't expect to receive 503 service unavailable messages when trying to create a VpcEndpoint. If the VpcEndpointService isn't ready - I would like to have some kind of (real) indication when it is indeed available. As stated above, the serviceState isn't reliable.

Current Behavior

At the moment, we are receiving 503 errors (service unavailable) after trying to create a VpcEndpoint on a newly created VpcEndpointService.

Reproduction Steps

Create a new VpcEndpointService

endpointServiceInput := &ec2.CreateVpcEndpointServiceConfigurationInput{
    NetworkLoadBalancerArns: []string{*awsProviderLoadBalancerArn},
    AcceptanceRequired:      aws.Bool(false),
    TagSpecifications:       []ec2types.TagSpecification{Tags},
}
AwsEc2Client.CreateVpcEndpointServiceConfiguration(ctx, endpointServiceInput)

Create a new VpcEndpoint:
endpointResourceInput := &ec2.CreateVpcEndpointInput{
    VpcId:             edgeClusterVpcID,
    ServiceName:       endpointServiceName,
    VpcEndpointType:   ec2types.VpcEndpointTypeInterface,
    SubnetIds:         []string{*subnetID},
    SecurityGroupIds:  []string{*securityGroupID},
    TagSpecifications: []ec2types.TagSpecification{Tags},
}
endpointResourceOutput, err := awsEc2Client.CreateVpcEndpoint(ctx, endpointResourceInput)

Possible Solution

No response

Additional Information/Context

No response

AWS Go SDK V2 Module Versions Used

github.com/aws/aws-sdk-go-v2 v1.18.1 github.com/aws/aws-sdk-go-v2/service/ec2 v1.61.0

Compiler and Version used

go1.20.5

Operating System and version

darwin/amd64 - but runs in a kubernetes on docker image

Tyzanol avatar Aug 23 '23 09:08 Tyzanol