Questions tagged [aws-sdk-go-v2]

32 questions
12
votes
0 answers

Simplifying AWS SDK GO v2 testing/mocking

Amazon has a super useful article describing how to unit test AWS SDK Go v2. I understand their motivation to depart from the "old" way of unit testing the v1 API, which I think aligns with this CodeReviewComment. However, I'm running into a…
Tim Reddy
  • 4,340
  • 1
  • 40
  • 77
6
votes
1 answer

aws-sdk-go-v2 custom logger

With v1 of the SDK i could use logrus for my custom logger, like: Logger: aws.LoggerFunc(func(args ...interface{}) { log.WithField("process", "s3").Debug(args...) }), This has changed with sdk v2,…
Rygo
  • 159
  • 1
  • 8
5
votes
1 answer

Convert DynamoDB JSON to AttributeValue, Go Object or Json

I am trying to convert simple DynamoDB Object string: { "Item": { "Id": { "S": "db31" }, "CreateTime": { "N": "1647882237618915000" } } to either dynamodb.AttributeValue and then map to a go object (go type structure)…
QuirkyBit
  • 654
  • 7
  • 20
3
votes
1 answer

aws-sdk-go-v2 PutObject api error AccessDenied

In our Staging environment, we have credential-less access to our private S3 buckets. Access is granted to individual Docker containers. I am trying to upload a file using PutObject using the aws-sdk-go-v2 SDK library, but I'm continually getting…
MeanwhileInHell
  • 6,780
  • 17
  • 57
  • 106
2
votes
1 answer

Passing multiple values to expression.in() of aws-sdk-go-v2 for DynamoDB

I am trying to pass a list of values to the 'IN' expression in aws-sdk-go-v2 and I cannot figure out how to do it dynamically. This is what it looks like now. func Find(colors []string) ([]Trip, error) { db := database.GetClient() filt :=…
2
votes
1 answer

PutApprovalResult issue with result struct

I have this lambda go code, which approves a code deploy manual action step at a certain stage. If the preview stage was successful then lambda will auto-approve the action. If not, then someone will have to check and do it manually. As a starting…
rek2
  • 101
  • 12
2
votes
1 answer

Detach thing from AWS IoT Certificate

I am trying to delete AWS IoT certificates for a Thing. I am using aws-sdk-go-v2. From documentation I understood that to delete certificates, we must: 1) detach policy 2) detach thing 3) set certificate as inactive and then 4) delete…
qa805542
  • 65
  • 4
2
votes
1 answer

How to authenticate gocql to AWS

I have a Go service that needs to connect Keyspaces on AWS. My pod has a role and AWS_SECRET_ACCESS_KEY, AWS_ACCESS_KEY_ID and AWS_SESSION_TOKEN env vars. I want to use aws SDK v2. What credential provider should I use? ec2rolecreds or other one…
Yura
  • 969
  • 14
  • 33
1
vote
0 answers

Dynamodb unit testing with aws-sdk-go-v2

I have a go project where I am having a query method called "queryMyTable". Here is the code for the method. func queryMyTable(ctx context.Context, dynamodbClient *dynamodb.Client, tableName string, ids []string) (*dynamodb.QueryOutput, error) { …
davidbilla
  • 2,120
  • 1
  • 15
  • 26
1
vote
0 answers

Using golang aws sdk v2 with eks farget profile

I have service which using go sdk v2 to read data from parameter store. I have farget profile with pod execution role attached to it with required permissions. func getClient() aws.Config { cfg, err := awsconfig.LoadDefaultConfig(context.TODO()) if…
Ajay Kumar
  • 19
  • 1
1
vote
0 answers

golang reproducable binary - changing buildId

Currently trying to work out why building twice from same source creates different buildid and more specifically different actionID part. I have vendored the dependencies with the following main.go package main import ( "context" "fmt" …
amwill04
  • 1,330
  • 1
  • 11
  • 18
1
vote
1 answer

How to serialize DynamoDB LastEvaluatedKey to string

Have a requirement of transferring the LastEvaluatedKey returned from the query output as the response of a paginated API call so that the users can request the next page with the LastEvaluatedKey. Is it possible to convert with aws-sdk-go-v2 ? Have…
1
vote
0 answers

Server Side Encryption with AWS KMS managed keys require AWS SigVer4, which I am

I am trying to download a file from an S3 bucket, but am seeing the following error: api error InvalidArgument: Requests specifying Server Side Encryption with AWS KMS managed keys require AWS Signature Version 4. However, when creating my S3…
MeanwhileInHell
  • 6,780
  • 17
  • 57
  • 106
1
vote
1 answer

How do you decompress a gzip file when using the aws-sdk-go-v2 s3 Downloader without writing the compressed file to disk first?

As per the changelog provided in the aws-sdk-go-v2 module we can see that they have Disable[d] automatic decompression of getting Amazon S3 objects with the Content-Encoding: gzip metadata header. They go on to say that you should use the…
Wafer
  • 188
  • 3
  • 17
1
vote
1 answer

AWS GO SDK Assume role given to EC2 instance

I am running a small go application inside ec2 instance. It access Amazon SQS as a consumer. I have configured keys at ~/.aws/credential file. The EC2 instance has been assigned an IAM role. Can my go application use the IAM role assigned to the…
user2307172
  • 141
  • 1
  • 9
1
2 3