aws-sdk-go-v2 | AWS SDK for the Go programming language | SDK library
kandi X-RAY | aws-sdk-go-v2 Summary
kandi X-RAY | aws-sdk-go-v2 Summary
aws-sdk-go-v2 is the v2 AWS SDK for the Go programming language. The v2 SDK requires a minimum version of Go 1.15. Checkout out the release notes for information about the latest bug fixes, updates, and features added to the SDK.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of aws-sdk-go-v2
aws-sdk-go-v2 Key Features
aws-sdk-go-v2 Examples and Code Snippets
Community Discussions
Trending Discussions on aws-sdk-go-v2
QUESTION
I have a lambda trigger in my user pool (post confirmation lambda trigger), which calls the code below:
...ANSWER
Answered 2022-Apr-16 at 03:47I have found the answer. As isavinof said, the value has a string type, which wasn't working initially, however, it turned out to be a permissions error ( AccessDeniedException ).
To fix the problem, I followed this answer: https://stackoverflow.com/a/67678111/1898662
I. CREATING THE POLICY (FOR PERMISSION)
- Go to IAM console -> Policies -> Create Policy.
- Choose "Cognito User Pools" Services.
- Specify the desired actions for which you need permission for (List, Read,
etc.) In this case, it was write -> AdminUpdateUserAttributesInput - Specify Resources - the userpool region and id
- Choose request conditions (optional).
- Add Tags (Optional) - helps with searching in a large list of policies
- Give name and description of the policy - be exact as it helps to ensure you have chosen the right one in the next stage
- Click on "Create Policy" button. POLICY CREATED.
II. ADDING THE POLICY TO THE USER :
- Go to IAM console -> Users (in this case, roles, not users, and find the lambda function role. If you don't know it, view it in the lambda backend, under permissions)
- Select the desired role.
- In permissions tab, click on Add Permissions.
- Click on "Attach existing policy directly".
- Search for the policy you just created.
- Click on "Add Permissions" ISSUE IS RESOLVED.
QUESTION
I'm performing a simple table Scan to get all items from my DynamoDB table, products
. Here is the whole Lambda:
ANSWER
Answered 2022-Apr-03 at 18:40Scanning the table returns the map of items and you want to convert map into the struct so in order to convert the list of maps to the struct you want to use attributevalue.UnmarshalListOfMaps under aws-sdk-go-v2. In the previous version it was in the dynamodbattribute but they decided to change the package in the v2.
QUESTION
I know there are no folders in Amazon S3, but we can emulate them by using "/" on the key name. Given that, is it possible using the AWS SDK for Go v2 to calculate the size of a folder? Or do I have to retrieve all objects in the folder and then calculate one by one the size?
...ANSWER
Answered 2021-Sep-19 at 09:09Not sure if the easiest way, however you can iterate over your objects list of interest - https://docs.aws.amazon.com/AmazonS3/latest/API/API_ListObjectsV2.html, and aggregate the size locally.
QUESTION
I have tried both AWS Go SDKs both versions and every time I get an error stating that the Details field is malformed. The Details field accepts a JSON string.
In SDK V2 you basically have a struct for the event
...ANSWER
Answered 2022-Mar-04 at 19:58The code on the page you linked is not 100% correct. They actually link the "complete example" at the bottom of the page, which has slightly different code:
QUESTION
In aws-sdk-v2 library for Go, we have the following interfaces definitions:
...ANSWER
Answered 2022-Feb-28 at 09:08Likely you are using an old version of Go. Overlapping method sets are allowed since Go 1.14, and the code compiles on the Go Playground.
Quoting from Go 1.14 release log:
Per the overlapping interfaces proposal, Go 1.14 now permits embedding of interfaces with overlapping method sets: methods from an embedded interface may have the same names and identical signatures as methods already present in the (embedding) interface. This solves problems that typically (but not exclusively) occur with diamond-shaped embedding graphs. Explicitly declared methods in an interface must remain unique, as before.
If you get a compile-time error for the code you posted, that suggests you're using a Go prior to 1.14. Urgently update! Please note that only the last 2 major versions are supported (currently 1.17 and 1.16). You using a version like 1.13 is a major risk!
QUESTION
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 (maybe stscreds
)?
I tried to implement example from here. But I get an error
...ANSWER
Answered 2022-Feb-08 at 00:26no EC2 IMDS role found, operation error ec2imds: GetMetadata, exceeded maximum number of attempts, 3, request send failed, Get \"http://169.254.169.254/latest/meta-data/iam/security-credentials/\": dial tcp 169.254.169.254:80: connect: host is down
Your snippet of code is attempting to use the EC2 instance meta-data service to read an IAM role to use. For that to work, you need to be able to communicate with it, and the role must be attached to the instance.
Is your Go service running on an EC2 instance? If not, that would explain your error. If it is, make sure the process or container has appropriate network access (eg: network namespace) to communicate with 169.254.169.254.
QUESTION
With v1 of the SDK i could use logrus for my custom logger, like:
...ANSWER
Answered 2022-Jan-29 at 10:55It seems that sdk v2 offers a func wrapper to satisfy logging.logger:
QUESTION
I've got an AWS Object Lambda Access Point. (These are sort of like a proxy lambda function which can intercept S3 requests and transform them.) It runs fine when not run inside a VPC (so I think IAM is fine). A later iteration will want to access private resources so I want it running inside a VPC.
The flow of one of these lambdas (at least when transforming a GET request) is:
- Get invoked
- Download the object that was requested using a HTTP client (you get a pre-signed URL to grant access (
getObjectContext.inputS3Url
in the payload)) - Do your transformation
- Write the result using
s3.Client.WriteGetObjectResponse
It's the last step that isn't working for me.
In my VPC I've added a gateway endpoint for S3 (for S3 either gateway or interface endpoints are supported; gateways are free. This works fine to fetch the object (step 2), I can download the object and work on it. I think that download happens through the gateway endpoint. So far so good.
But after doing the processing it times out when trying to write the response (step 4). In the logs it looks like this:
...ANSWER
Answered 2022-Jan-13 at 13:39The short answer is: You can run your object lambda function in a VPC as long as you allow it to route to s3-object-lambda..amazonaws.com through the internet, e.g. through a NAT gateway. You were on the right track and basically figured it out in your question already.
The S3 gateway interface endpoint is necessary to enable download of the input object.
When writing the result, the request goes to s3-object-lambda
, which is technically a different service than S3 (at least on network level). AWS currently doesn't provide an interface endpoint for s3-object-lambda and the S3 gateway endpoint doesn't cover it either (which can be verified by comparing the IP address WriteGetObjectResponse
request goes to and the routes created by the gateway endpoint).
So the only way is to route WriteGetObjectResponse
requests via opened access to the internet. For future reference, one way to set this up is with a NAT gateway. Quoting AWS docs:
- The NAT gateway must be in a public subnet with a route table that routes internet traffic to an internet gateway.
- Your instance must be in a private subnet with a route table that routes internet traffic to the NAT gateway.
- Check that there are no other route table entries that route all or part of the internet traffic to another device instead of the NAT gateway.
In other words:
- Provision a public NAT Gateway in a public subnet and allocate it an elastic IP
- Make sure the public subnet has an internet gateway and the default route (
0.0.0.0/0
) points to it. - Set up a default route (
0.0.0.0/0
) from the subnet hosting your lambda and point it to the NAT Gateway.
You're right that a NAT Gateway is priced by the hour, unfortunately, and you need one per subnet.
In theory, you could at least limit the egress with a security group to IP addresses of the s3-object-lambda
service, but I'm not aware these IP ranges are published anywhere.
QUESTION
When working with DynamoDB in Golang, if a call to query
has more results, it will set LastEvaluatedKey
on the QueryOutput
, which you can then pass in to your next call to query
as ExclusiveStartKey
to pick up where you left off.
This works great when the values stay in Golang. However, I am writing a paginated API endpoint, so I would like to serialize this key so I can hand it back to the client as a pagination token. Something like this, where something
is the magic package that does what I want:
ANSWER
Answered 2021-Jul-08 at 23:54OK, I figured something out.
QUESTION
I am using AWS S3 service to upload images. Yesterday I updated the SDK v1 to v2 and found that the image upload is failing with the following error:
...ANSWER
Answered 2021-Jun-25 at 11:48After spending a couple of days, I came to know that SDK V2 takes following format for Bucket & Key field:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install aws-sdk-go-v2
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page