Skip to content

Commit e055d2a

Browse files
committed
tool: Add source of Go SDK's credential provider
It will be compiled as part of CI artifacts build and the built binary will be placed in guest rootfs. Signed-off-by: Takahiro Itazuri <[email protected]>
1 parent 0ddc997 commit e055d2a

File tree

2 files changed

+35
-1
lines changed

2 files changed

+35
-1
lines changed
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
package main
2+
3+
import (
4+
"context"
5+
"fmt"
6+
"log"
7+
8+
"github.com/aws/aws-sdk-go-v2/aws"
9+
"github.com/aws/aws-sdk-go-v2/config"
10+
)
11+
12+
func main() {
13+
cfg, err := config.LoadDefaultConfig(
14+
context.TODO(),
15+
config.WithClientLogMode(
16+
aws.LogSigning|
17+
aws.LogRetries|
18+
aws.LogRequest|
19+
aws.LogRequestWithBody|
20+
aws.LogResponse|
21+
aws.LogResponseWithBody,
22+
),
23+
)
24+
if err != nil {
25+
log.Fatalf("Unable to load config: %v", err)
26+
}
27+
28+
cred, err := cfg.Credentials.Retrieve(context.TODO())
29+
if err != nil {
30+
log.Fatalf("Unable to retrieve credentials: %v", err)
31+
}
32+
33+
fmt.Printf("%v,%v,%v\n", cred.AccessKeyID, cred.SecretAccessKey, cred.SessionToken)
34+
}

resources/rebuild.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ function build_al_kernel {
201201
function prepare_and_build_rootfs {
202202
BIN_DIR=overlay/usr/local/bin
203203

204-
SRCS=(init.c fillmem.c fast_page_fault_helper.c readmem.c)
204+
SRCS=(init.c fillmem.c fast_page_fault_helper.c readmem.c go_sdk_cred_provider.go)
205205
if [ $ARCH == "aarch64" ]; then
206206
SRCS+=(devmemread.c)
207207
fi

0 commit comments

Comments
 (0)