...

Package sdk

import "github.com/aws/aws-sdk-go-v2"
Overview
Index
Subdirectories

Overview ▾

Package sdk is the official AWS SDK v2 for the Go programming language.

aws-sdk-go-v2 is the the v2 of the AWS SDK for the Go programming language.

Getting started

The best way to get started working with the SDK is to use `go get` to add the SDK and desired service clients to your Go dependencies explicitly.

go get github.com/aws/aws-sdk-go-v2
go get github.com/aws/aws-sdk-go-v2/config
go get github.com/aws/aws-sdk-go-v2/service/dynamodb

Hello AWS

This example shows how you can use the v2 SDK to make an API request using the SDK's Amazon DynamoDB client.

package main

import (
    "context"
    "fmt"
    "log"

    "github.com/aws/aws-sdk-go-v2/aws"
    "github.com/aws/aws-sdk-go-v2/config"
    "github.com/aws/aws-sdk-go-v2/service/dynamodb"
)

func main() {
    // Using the SDK's default configuration, loading additional config
    // and credentials values from the environment variables, shared
    // credentials, and shared configuration files
    cfg, err := config.LoadDefaultConfig(context.TODO(),
   		config.WithRegion("us-west-2"),
   	)
    if err != nil {
        log.Fatalf("unable to load SDK config, %v", err)
    }

    // Using the Config value, create the DynamoDB client
    svc := dynamodb.NewFromConfig(cfg)

    // Build the request with its input parameters
    resp, err := svc.ListTables(context.TODO(), &dynamodb.ListTablesInput{
        Limit: aws.Int32(5),
    })
    if err != nil {
        log.Fatalf("failed to list tables, %v", err)
    }

    fmt.Println("Tables:")
    for _, tableName := range resp.TableNames {
        fmt.Println(tableName)
    }
}

Index ▾

Package files

doc.go

Subdirectories

Name Synopsis
..
aws Package aws provides the core SDK's utilities and shared types.
arn Package arn provides a parser for interacting with Amazon Resource Names.
defaults Package defaults provides recommended configuration values for AWS SDKs and CLIs.
middleware
private
metrics Package metrics implements metrics gathering for SDK development purposes.
emf Package emf implements an EMF metrics publisher.
middleware
publisher
readcloserwithmetrics
testutils
protocol
ec2query
query
restjson
xml
ratelimit
retry Package retry provides interfaces and implementations for SDK request retry behavior.
signer
v4 Package v4 implements signing for AWS V4 signer
transport
http
config Package config provides utilities for loading configuration from multiple sources that can be used to configure the SDK's API clients, and utilities.
codegen
credentials Package credentials provides types for retrieving credentials from credentials sources.
ec2rolecreds Package ec2rolecreds provides the credentials provider implementation for retrieving AWS credentials from Amazon EC2 Instance Roles via Amazon EC2 IMDS.
endpointcreds Package endpointcreds provides support for retrieving credentials from an arbitrary HTTP endpoint.
processcreds Package processcreds is a credentials provider to retrieve credentials from a external CLI invoked process.
ssocreds Package ssocreds provides a credential provider for retrieving temporary AWS credentials using an SSO access token.
stscreds Package stscreds are credential Providers to retrieve STS AWS credentials.
feature
ec2
imds Package imds provides the API client for interacting with the Amazon EC2 Instance Metadata Service.
service
ecr Package ecr provides the API client, operations, and parameter types for Amazon EC2 Container Registry.
types
ecrpublic Package ecrpublic provides the API client, operations, and parameter types for Amazon Elastic Container Registry Public.
types
sso Package sso provides the API client, operations, and parameter types for AWS Single Sign-On.
types
ssooidc Package ssooidc provides the API client, operations, and parameter types for AWS SSO OIDC.
types
sts Package sts provides the API client, operations, and parameter types for AWS Security Token Service.
types