aws-sdk-go

Cant unmarshall dynamodb attribute

眉间皱痕 提交于 2021-02-09 11:47:22
问题 I'm experimenting with AWS-SDK-GO with the DynamoDB API... I'm trying to query the db and return a string. But I'm having some issues unmarshelling the return value.... struct type Item struct { slug string destination string } query function input := &dynamodb.GetItemInput{ Key: map[string]*dynamodb.AttributeValue{ "slug": { S: aws.String(slug), }, }, TableName: db.TableName, } result, err := db.dynamo.GetItem(input) if err != nil { return "", err } n := Item{} err = dynamodbattribute

DescribeInstances returns empty results

扶醉桌前 提交于 2021-01-28 08:40:50
问题 I am using DescribeInstances api fetch all my EC2 instances . But I am not able to get any information about my instance. I can only see empty results as success. I am providing my code in steps to reproduce section. Output I can see as below: Success { } I am also exporting AWS_ACCESS_KEY_ID,AWS_SECRET_ACCESS_KEY and AWS_REGION Below is the code Snippet <pre> <code> import ( "fmt" "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/ec2" ) func main() { // Load session

Decrypting using AWS go sdk

痴心易碎 提交于 2020-01-25 10:04:21
问题 I'm new to Golang, and am stuck on this issue for a day already. I am trying to write a small code snippet that decrypts (using AWS go sdk) the cipher text which was previously encrypted (using AWS python sdk). I don't see any problem doing this since the encrypted value is just a base64 encoded string, but I keep running into this error, InvalidCiphertextException , when trying to decrypt. Here's my GO code: package main import ( "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws

How to get data from aws Dynamodb with using partition key only?

女生的网名这么多〃 提交于 2020-01-22 14:40:04
问题 I am using aws-sdk-go library for DynamoDb connectivity in Golang. My DynamoDb table have a Partition key DeviceId (String) and a Sort Key Time (Number). How can I write GetItemInput to get all data with a specific DeviceId? params := &dynamodb.GetItemInput{ Key: map[string]*dynamodb.AttributeValue { "DeviceId": { S: aws.String("item_1"), }, }, ExpressionAttributeNames: map[string]*string{ "DeviceId": "DeviceId", }, TableName: aws.String("DbName"), } list, err := svc.GetItem(params) 回答1: You

How to get data from aws Dynamodb with using partition key only?

大憨熊 提交于 2020-01-22 14:39:31
问题 I am using aws-sdk-go library for DynamoDb connectivity in Golang. My DynamoDb table have a Partition key DeviceId (String) and a Sort Key Time (Number). How can I write GetItemInput to get all data with a specific DeviceId? params := &dynamodb.GetItemInput{ Key: map[string]*dynamodb.AttributeValue { "DeviceId": { S: aws.String("item_1"), }, }, ExpressionAttributeNames: map[string]*string{ "DeviceId": "DeviceId", }, TableName: aws.String("DbName"), } list, err := svc.GetItem(params) 回答1: You

How to access message attributes in SNS HTTPS subscription endpoint

扶醉桌前 提交于 2019-12-11 10:52:50
问题 I'm setting up an integration test to determine if a program that publishes a message to SNS is working correctly. The published message includes a few critical message attributes that I need to check in order to determine correctness. So far, I have set up a simple HTTP server that acts as an SNS subscriber. The server correctly confirms its subscription and even receives messages from the topic, however I am at a loss as to how to access the attributes of these messages. It should be

How to support more than one trigger in AWS Lambda in Golang?

爷,独闯天下 提交于 2019-12-06 02:53:49
问题 I am building an AWS Lambda function in Golang that copy the content from n to m S3 buckets. There is a requirement to support for S3 trigger as well as fetching the data from an SQS where all source S3 bucket change is stored. The code can be found here: https://github.com/maknahar/s3copy I tried following: func main() { lambda.Start(ProcessIncomingS3Events) lambda.Start(ProcessIncomingEvents) } func ProcessIncomingS3Events(event events.S3Event) error { ... log.Println("Got S3 Event") return

How to support more than one trigger in AWS Lambda in Golang?

两盒软妹~` 提交于 2019-11-30 21:27:54
I am building an AWS Lambda function in Golang that copy the content from n to m S3 buckets. There is a requirement to support for S3 trigger as well as fetching the data from an SQS where all source S3 bucket change is stored. The code can be found here: https://github.com/maknahar/s3copy I tried following: func main() { lambda.Start(ProcessIncomingS3Events) lambda.Start(ProcessIncomingEvents) } func ProcessIncomingS3Events(event events.S3Event) error { ... log.Println("Got S3 Event") return processS3Trigger(config, event) } func ProcessIncomingEvents() error { ... log.Println("Defaulting to