Skip to main content

AWS Go SDK v2 CheatSheet

AWS SDK for Go v2 CheatSheet.

Add HTTP header

Customize service client's HTTP header using smithy-go.

package main

import (
"github.com/aws/aws-sdk-go-v2/service/xray"
smithyhttp "github.com/aws/smithy-go/transport/http"
)

func createClientWithHeader() *xray.Client {
client = xray.NewFromConfig(awsCfg,
xray.WithAPIOptions(smithyhttp.AddHeaderValue("k1", "v1")),
xray.WithEndpointResolver(customResolver))
}