golang DynamoDB sdk AccessDeniedException

golang调用aws sdk时候提示:

AccessDeniedException: User: arn:aws:sts::818539432014:assumed-role/bj-develop/i-787f1cdc is not authorized to perform: dynamodb:PutItem on resource: arn:aws:dynamodb:xxx:818539432014:table/tablename_test

status code: 400, request id: TGNDJ7QEEGNUB2C4TIB8CI3HOBVV4KQNSO5AEMVJF66Q9ASUAAJG

出现以上原因是由于环境变量中没有读取到config文件。

使用aws configure 命令配置对应的 id 和key 以及 region即可。

参考: http://docs.aws.amazon.com/cli/latest/userguide/cli-chap-getting-started.html#cli-using-examples 

原文地址:https://www.cnblogs.com/lavin/p/6078957.html