github.com/aavshr/aws-sdk-go@v1.41.3/example/aws/credentials/plugincreds/README.md (about) 1 Retrieve Credentials with Go Plugin 2 === 3 4 This example demonstrates how you can take advantage of Go 1.8's new Plugin 5 functionality to retrieve AWS credentials dynamically from a plugin compiled 6 separate from your application. 7 8 Usage 9 --- 10 11 Example Plugin 12 --- 13 14 You can find the plugin at `plugin/plugin.go` nested within this example. The plugin 15 demonstrates what symbol the SDK will use when lookup up the credential provider 16 and the type signature that needs to be implemented. 17 18 Compile the plugin with: 19 20 go build -tags example -o myPlugin.so -buildmode=plugin plugin/plugin.go 21 22 JSON Credentials File 23 --- 24 25 This example plugin will read the credentials from a JSON file pointed to by 26 the `PLUGIN_CREDS_FILE` environment variable. The contents of the file are 27 the credentials, Key, Secret, and Token. The `Token` filed does not need to be 28 set if your credentials do not have one. 29 30 ```json 31 { 32 "Key": "MyAWSCredAccessKeyID", 33 "Secret": "MyAWSCredSecretKey", 34 "Token": "MyAWSCredToken" 35 } 36 ``` 37 38 Example Application 39 --- 40 41 The `main.go` file in this folder demonstrates how you can configure the SDK to 42 use a plugin to retrieve credentials with. 43 44 Compile and run application: 45 46 go build -tags example -o myApp main.go 47 48 PLUGIN_CREDS_FILE=pathToCreds.json ./myApp myPlugin.so myBucket myObjectKey 49