Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • Aug 31 2021 17:52
    github-actions[bot] commented #698
  • Aug 31 2021 17:52
    skmcgrail closed #698
  • Aug 31 2021 17:52
    skmcgrail commented #698
  • Aug 31 2021 15:27
    NukaCody commented #1384
  • Aug 31 2021 15:26
    NukaCody commented #1384
  • Aug 30 2021 23:04
    KaibaLopez labeled #1394
  • Aug 30 2021 21:04
    shawnHartsell commented #1397
  • Aug 30 2021 21:03
    shawnHartsell edited #1397
  • Aug 30 2021 21:02
    shawnHartsell opened #1397
  • Aug 30 2021 21:02
    shawnHartsell labeled #1397
  • Aug 30 2021 21:02
    shawnHartsell labeled #1397
  • Aug 30 2021 16:33
    jasdel unlabeled #698
  • Aug 29 2021 00:04
    github-actions[bot] labeled #698
  • Aug 29 2021 00:04
    github-actions[bot] commented #698
  • Aug 27 2021 22:58

    skmcgrail on updateDocs

    (compare)

  • Aug 27 2021 22:58

    skmcgrail on documentation

    Regenerated Documentation (#139… (compare)

  • Aug 27 2021 22:58
    skmcgrail closed #1396
  • Aug 27 2021 22:02

    skmcgrail on updateModels

    (compare)

  • Aug 27 2021 22:02

    skmcgrail on main

    Update API Models for Release (… (compare)

  • Aug 27 2021 22:02
    skmcgrail closed #1395
Promaethius
@Promaethius
@thebenwaters do you have a working example on using endpoints?
Jeff
@jcarter3
what version were you using when the endpoints did work?
Promaethius
@Promaethius
I'm used to the v1 sdk where the endpoint resolver is passed as a function in with a general config, trying to migrate
rfc2119
@rfc2119
v0.26.0 breaks a lot of stuff. Since this chat room is not active, anyone know where do gophers using the SDK hang out ?
Jeff
@jcarter3
@rfc2119 yes it does... took a couple days to fix all the errors (though my project is probably not normal)
Alban B
@aboitier_gitlab
@rfc2119 good question
ranamuerta
@ranamuerta
is v.0.29.0 safe to use? i have many middleware dependency issues.
../../../../pkg/mod/github.com/aws/aws-sdk-go-v2/service/sts@v0.29.0/api_op_AssumeRole.go:326:2: undefined: "github.com/aws/aws-sdk-go-v2/aws/middleware".AddRequestInvocationIDMiddleware
Dre
@dre2004
is "github.com/aws/aws-sdk-go-v2/aws/external" broken? I get ain.go:8:2: module github.com/aws/aws-sdk-go-v2@latest found (v0.29.0), but does not contain package github.com/aws/aws-sdk-go-v2/aws/external or is the documentation out of date?
Ichinose Shogo
@shogo82148
which documentation?
AWS introduced big breaking changes into v0.25.0. aws/external is renamed to aws/config. https://github.com/aws/aws-sdk-go-v2/blob/master/CHANGELOG.md#relocated-packages
I guess a lot of it seems out of date, the config package isn't there
Ichinose Shogo
@shogo82148
yes, it is out of date. it looks that it doesn't contain the changes of v0.25.0. v0.25.0 breaks many and many things...
JaeHoon Kim
@LumpKim
Hello, I have a question about types.BucketLocationConstraint.
When I call s3.Client.GetBucketLocation and print s3.GetBucketLocationOutput.BucketLocationConstraint, it shows nothing.
Is there any solutions? aws-sdk-go-v2 documentation always says about v1!
Jeff
@jcarter3
@LumpKim i don't believe there is a workaround for this yet, I think it's broken at the generation-via-smithy level
JaeHoon Kim
@LumpKim
Thanks @jcarter3
Andy Spence
@AndySpe85815249_twitter
Not getting this example snippet: aws.EndpointResolverFunc(func(service, region string) (aws.Endpoint, error) {} - service does not have a Type ? https://aws.github.io/aws-sdk-go-v2/docs/configuring-sdk/endpoints/
This-Is-Not-Brad
@This-Is-Not-Brad
I'm having great difficulty getting v4 signing working since the 0.25.0 changes. Doing a basic GET to an IAM authorised Lambda. Are their any updated examples? All the documentation\resources I can find appear to be for <0.25.0
Julio Chana
@jchanam
Hi!
I'm developing some tools with the SDK and I'd like to know if there's documentation in some places about the possible errors that a call could give. I'm using the errors.As to check if the error given is a specific one but sometimes I can't know the kind to expect.
1 reply
Kaveh Shahbazian
@dc0d
Is there an example of how to use AWS SDK v2 for implementing a lambda function?
Milos Gajdos
@milosgajdos
is there a guide how to get the java cruft used for codegen in V2 working?
I've been fighting with it for a few hours here and then and keep getting this error
$ make smithy-generate
cd codegen && ./gradlew clean build -Plog-tests && ./gradlew clean
/Users/milosgajdos/go/src/github.com/aws/aws-sdk-go-v2/codegen

> Configure project :protocol-test-codegen
(scanned and found a Smithy CLI version 1.5.1. You will need to add an explicit dependency on smithy-model if publishing a JAR)

> Configure project :sdk-codegen
(scanned and found a Smithy CLI version 1.5.1. You will need to add an explicit dependency on smithy-model if publishing a JAR)

> Task :smithy-aws-go-codegen:compileJava FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':smithy-aws-go-codegen:compileJava'.
> Could not resolve all files for configuration ':smithy-aws-go-codegen:compileClasspath'.
   > Could not find software.amazon.smithy:smithy-go-codegen:0.1.0.
     Searched in the following locations:
       - file:/Users/milosgajdos/.m2/repository/software/amazon/smithy/smithy-go-codegen/0.1.0/smithy-go-codegen-0.1.0.pom
       - https://repo.maven.apache.org/maven2/software/amazon/smithy/smithy-go-codegen/0.1.0/smithy-go-codegen-0.1.0.pom
     Required by:
         project :smithy-aws-go-codegen

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.5/userguide/command_line_interface.html#sec:command_line_warnings

BUILD FAILED in 1s
4 actionable tasks: 1 executed, 3 up-to-date
make: *** [smithy-generate] Error 1
Milos Gajdos
@milosgajdos
Originally I thought it was because smithy-go-codegen version seemed too low i.e. above you can see it uses 0.1.0 whilst it seems (according to GH tags it should be 1.0.0, but even changing the gradle settings didn't help)
Kristoffer Ahl
@kristofferahl

Hey all! I've been trying to do the following against Route53 with the v2 SDK ...

  1. Create a Hosted Zone for a subdomain ("subdomain1.app.example.com")
  2. Add NS record for subdomain1 to the parent Hosted Zone ("app.example.com")

Creating the Hosted Zone for the subdomain is no problem but adding the NS record fails with the following error message:
InvalidInput: Invalid request: Expected exactly one of [Weight, Region, Failover, GeoLocation, or MultiValueAnswer], but found none in Change with [Action=UPSERT, Name=subdomain1.apps.example.com., Type=NS, SetIdentifier=Upsert NS record]

If I use the AWS Management Console to add the NS record, I do not need to specify any of the above and it works great. What is the proper way of adding an NS record to a Hosted Zone? Can't find any examples out there for NS records.
Here's the code snippet I'm working with:

params := route53.ChangeResourceRecordSetsInput{
    ChangeBatch: &types.ChangeBatch{
        Changes: []types.Change{
            {
                Action: types.ChangeActionUpsert,
                ResourceRecordSet: &types.ResourceRecordSet{
                    Name:            "subdomain1.app.example.com",
                    Type:            types.RRTypeNs,
                    ResourceRecords: []types.ResourceRecord{
                        ... values goes here ...
                    },
                    TTL:             aws.Int64(300),
                    SetIdentifier:   aws.String("Upsert NS record"),
                },
            },
        },
        Comment: aws.String("Upserting NS record in parent zone"),
    },
    HostedZoneId: aws.String("<id of parent zone app.example.com>"),
}
res, err := r.Route53.ChangeResourceRecordSets(ctx, &params)

Any help would be much appreciated!

BTW. r.Route53 is the route53.Client ...
Kid Hailu
@kidanekal

Hello,

I have a service written by using go sdk 1.X and planning to convert it to go-sdk 2, the service has a test that uses the 1.x interfaces for example "github.com/aws/aws-sdk-go/service/ec2/ec2iface and instantiate objects to mock the service in the test.

My question is

  1. What is the reasoning behind removing the *iface interfaces from aws services in v2.0? The change makes mocking and testing a bit difficult.
1 reply
The interface was easier to mock and do the testing -- https://github.com/aws/aws-sdk-go/blob/master/service/ec2/ec2iface/interface.go
Kristoffer Ahl
@kristofferahl
If anyone is interested, removing SetIdentifier: aws.String("Upsert NS record"), solved it for me. NS records should be created as a "simple" record type.
Tyler Dockstader
@tydock88_twitter

hello everyone, I am trying to disable sourcedestcheck on the ENI level, this block of code works if SourceDestCheck: is true, but says api error InvalidParameterCombination: No attributes specified. if SourceDestCheck: is false, I am stuck on how to disable SourceDestCheck

``` input := &ec2.ModifyNetworkInterfaceAttributeInput{
NetworkInterfaceId: aws.String(eni),
SourceDestCheck: &types.AttributeBooleanValue{
Value: false,
},
}

_, err := client.ModifyNetworkInterfaceAttribute(context.Background(), input)
```

Tyler Dockstader
@tydock88_twitter
am I running into some sort of bug with the sdk?
bhargavak
@kbhagi
Folks , trying to Set Handler for the function here using Golang v2
AWS public facing documentation for DynamoDb doesn't tell how to wrap it using an Handler for Lambda function

package main

import (
"context"
"fmt"
"log"

"github.com/aws/aws-sdk-go-v2/aws"
"github.com/aws/aws-sdk-go-v2/config"
"github.com/aws/aws-sdk-go-v2/service/dynamodb"
"github.com/aws/aws-sdk-go-v2/service/lambda"

)

var client dynamodb.Client

func init() {
// Using the SDK's default configuration, loading additional config
// and credentials values from the environment variables, shared
// credentials, and shared configuration files
cfg, err := config.LoadDefaultConfig(context.TODO(), config.WithRegion("eu-central-1"))
if err != nil {
log.Fatalf("unable to load SDK config, %v", err)
}

// Using the Config value, create the DynamoDB client
client := dynamodb.NewFromConfig(cfg)

}
func TablesOperation() {

// Build the request with its input parameters
resp, err := client.ListTables(context.TODO(), &dynamodb.ListTablesInput{
    Limit: aws.Int32(5),
})
if err != nil {
    log.Fatalf("failed to list tables, %v", err)
}

fmt.Println("Tables:")
for _, tableName := range resp.TableNames {
    fmt.Println(tableName)
}

}

func main() {
// xray.AWS(dbSession.Client)
lambda.CreateFunctionInput(Handler * TablesOperation)

}

bhargavak
@kbhagi
@jasdel How to set an handler for Golang SDK v2 targeted towards Lambda functions
jamielaux
@jamielaux

@kbhagi

aws has a lib called go-api-proxy
that you can use to wrap a lambda to respond to a normal http interface

below is an example with gorilla mux

package main

import (
    "context"

    "github.com/aws/aws-lambda-go/events"
    "github.com/aws/aws-lambda-go/lambda"

    "github.com/awslabs/aws-lambda-go-api-proxy/gorillamux"
    "github.com/gorilla/mux"
)

var adaptor *gorillamux.GorillaMuxAdapter

func init() {
    r := mux.NewRouter()
    r.HandleFunc("/", YOURHANDLER).Methods("POST")

    adaptor = gorillamux.New(r)
}

func main() {
    lambda.Start(func(ctx context.Context, req events.APIGatewayProxyRequest) (events.APIGatewayProxyResponse, error) {
        return adaptor.ProxyWithContext(ctx, req)
    })
}
Sam Perrin
@speza
Hello :wave: I'm looking to add generic tracing in for aws-sdk-go-v2 (similar to https://github.com/DataDog/dd-trace-go/tree/v1/contrib/aws/aws-sdk-go/aws). Before I dive in, I wondered if anyone here could recommended a way that is nice and generic given the v2 SDK structure? Possibly middleware?
1 reply
jamielaux
@jamielaux
@speza you can also check out amazons own tracing service xray https://docs.aws.amazon.com/xray/latest/devguide/xray-sdk-go-awssdkclients.html
to see how they do it
while not v2 it may help for reference https://github.com/aws/aws-xray-sdk-go
Sam Perrin
@speza
Thanks @jamielaux I will check it out :)
pradeepp28
@pradeepp28
Currently I am using aws s3manager BatchUploadIterator to upload all files we have in multipart form, how do we do this in aws-sdk-go-v2?
I searched the documentation, couldn't find the similar one in aws-sdk-go-v2
Federico Ragona
@fedragon
Hi everybody, I just upgraded to v2 and I have some tests which are now failing: these tests spin up a localstack instance, create a Kinesis stream, and then put some records into it. They work fine locally but fail in my pipeline, where I'm using a remote DOCKER_HOST. This is how I have configured it so far. I'm making sure to replace the endpoint and region according to my configuration (as much as I could find on the documentation, at least) but CreateStream fails with context deadline exceeded. Has anyone encountered similar issues?
import (
  "github.com/aws/aws-sdk-go-v2/aws"
  "github.com/aws/aws-sdk-go-v2/config"
  "github.com/aws/aws-sdk-go-v2/service/kinesis"
  "github.com/aws/aws-sdk-go-v2/service/kinesis/types"
  "github.com/aws/smithy-go"
)

var (
  kinesisStreamName             = aws.String("my-stream")
  kinesisRegion                          = "eu-west-1"
  kinesisShardsCount int32 = 1
)

func TestIt(t *testing.T) {
  endpointResolver := aws.EndpointResolverFunc(func(service, region string) (aws.Endpoint, error) {
    if service == kin.ServiceID && region == kinesisRegion {
      return aws.Endpoint{
        PartitionID:   "aws",
        URL:           kinesisEndpoint,
        SigningRegion: kinesisRegion,
      }, nil
    }
    return aws.Endpoint{}, fmt.Errorf("unknown endpoint requested")
  })

  cfg, err := config.LoadDefaultConfig(context.Background(), config.WithRegion(kinesisRegion), config.WithEndpointResolver(endpointResolver))
  if err != nil {
    logAwsError(s.t, "unable to load AWS configuration", err)
  }

  client := kinesis.NewFromConfig(cfg)

  ctx, cancel := context.WithTimeout(context.Background(), time.Minute)
  defer cancel()

  _, err := s.testKinesisClient.CreateStream(ctx, &kin.CreateStreamInput{
    StreamName: kinesisStreamName,
    ShardCount: &kinesisShardsCount,
  })
  if err != nil {
    logAwsError(s.t, "unable to create Kinesis stream", err)
  }
}
Zaq? Wiedmann
@zaquestion
@fedragon I am have similar ish issues with the latest v2 stuff and local stack. Creating tables doesn't complete, but on second run fails complaining the table exists, describes return "ResourceNotExists". awslocal won't return the table either. Manually creating the tables with awslocal works, and I can list and describe the tables, but then with the v2 sdk describes still return ResourceNotExists... Feels like the v2 sdk is borked since all other aws provided tooling works fine, but maybe v2 is just using calls that are too fancy for localstack right now... I've yet to properly try against real aws since I'm struggling to get the service passing even basic local testing.
Zaq? Wiedmann
@zaquestion
hmm, well all the same operations definitely work with real aws, no real surprises there, not sure what's so fundamentally different that localstack is simply not having it
Ruben Rodriguez
@scyellleader
I'm new to Go and just trying to learn. I doing a simple DescribeTargetGroups call and I have output problems in the v2 of the sdk. V1 outputs nice json similar to the aws cli. V2 output seems to not be dereferenced. Code is below. I think it is probably a simple issue. Would be great if someone had some pointers.
package main

import (
    "context"
    "fmt"
    "log"

    "github.com/aws/aws-sdk-go-v2/config"
    "github.com/aws/aws-sdk-go-v2/service/elasticloadbalancingv2"
    awsv1 "github.com/aws/aws-sdk-go/aws"
    "github.com/aws/aws-sdk-go/aws/awserr"
    "github.com/aws/aws-sdk-go/aws/session"
    "github.com/aws/aws-sdk-go/service/elbv2"
)

type ELBV2DescribeTargetGroupsAPI interface {
    DescribeTargetGroups(ctx context.Context,
        params *elasticloadbalancingv2.DescribeTargetGroupsInput,
        optFns ...func(*elasticloadbalancingv2.Options)) (*elasticloadbalancingv2.DescribeTargetGroupsOutput, error)
}

func GetTargetGroups(c context.Context, api ELBV2DescribeTargetGroupsAPI, input *elasticloadbalancingv2.DescribeTargetGroupsInput) (*elasticloadbalancingv2.DescribeTargetGroupsOutput, error) {
    return api.DescribeTargetGroups(c, input)
}

func main() {

    // V2
    cfg, err := config.LoadDefaultConfig(context.TODO(),
        config.WithSharedConfigProfile("sbx"),
        // config.WithClientLogMode(aws.LogRetries|aws.LogRequest),
    )
    if err != nil {
        log.Fatal(err)
    }
    svc := elasticloadbalancingv2.NewFromConfig(cfg)
    input := &elasticloadbalancingv2.DescribeTargetGroupsInput{
        TargetGroupArns: []string{
            "arn:aws:elasticloadbalancing:us-east-1:XXXXXXXXXXXX:targetgroup/a0e3ff30-08e4a17b024aed88309/2d2200b37e80bc25",
        },
    }
    result, err := GetTargetGroups(context.TODO(), svc, input)
    if err != nil {
        log.Fatal(err)
    }
    fmt.Println(result)

    // V1
    sess := session.Must(session.NewSessionWithOptions(session.Options{
        SharedConfigState: session.SharedConfigEnable,
        Profile:           "sbx",
    }))
    svcv1 := elbv2.New(sess)
    inputv1 := &elbv2.DescribeTargetGroupsInput{
        TargetGroupArns: []*string{
            awsv1.String("arn:aws:elasticloadbalancing:us-east-1:XXXXXXXXXXXXX:targetgroup/a0e3ff30-08e4a17b024aed88309/2d2200b37e80bc25"),
        },
    }
    resultv1, err := svcv1.DescribeTargetGroups(inputv1)
    if err != nil {
        if aerr, ok := err.(awserr.Error); ok {
            switch aerr.Code() {
            case elbv2.ErrCodeLoadBalancerNotFoundException:
                fmt.Println(elbv2.ErrCodeLoadBalancerNotFoundException, aerr.Error())
            case elbv2.ErrCodeTargetGroupNotFoundException:
                fmt.Println(elbv2.ErrCodeTargetGroupNotFoundException, aerr.Error())
            default:
                fmt.Println(aerr.Error())
            }
        } else {
            // Print the error, cast err to awserr.Error to get the Code and
            // Message from an error.
            fmt.Println(err.Error())
        }
        return
    }
    fmt.Println(resultv1)
}
The Fueley
@thefueley
*/9+
Alexandre Viau
@aviau
Hey all! Quick question I was wondering why don't the NewFromConfig functions accept a config pointer? Is there something about Configs that makes them not suitable to passing around as pointers?
Anirudh Kaushik
@anirudh-k
not entirely clear how to construct a GetItemInput, Key map[string]types.AttributeValue with the go sdk v2. could someone provide a code example? here's what i've got but I keep getting ValidationExceptions
keyCond := expression.KeyAnd(
    expression.Key("pk").Equal(expression.Value("pk_val")),
    expression.Key("sk").Equal(expression.Value("sk_val")),
)

proj := expression.NamesList(expression.Name("pk"), expression.Name("sk"))

builder := expression.NewBuilder().WithKeyCondition(keyCond).WithProjection(proj)
expr, err := builder.Build()
input := &dynamodb.GetItemInput{
    Key:       expr.Values(),
    TableName: aws.String("table_name"),
}

result, err := client.GetItem(ctx, input)
Ricardo Kirkner
@ricardokirkner
Hi, I'm having some issues with the s3/manager.GetBucketRegion function... the documentation says that it will do a non-signed request with anonymous credentials to find the right bucket. However, I'm using a custom endpoint and it's failing with a 403 response. I can make it work by passing some options to override the credentials but since that's not documented I was wondering if I'm abusing the implementation somehow, or if there is a better way to do this.
Dan Garthwaite
@dangarthwaite
Does this SDK work with google Cloud Storage's interoperability mode? I'm having SignatureDoesNotMatch errors. Their docs show that it should work with aws/aws-sdk-go - should it also work with -v2?