README

AWS SDK for Go v2

Build Status SDK Documentation API Reference Apache V2 License

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

The v2 SDK requires a minimum version of Go 1.15.

Checkout out the release notes for information about the latest bug fixes, updates, and features added to the SDK.

Jump To:

Maintenance and support for SDK major versions

For information about maintenance and support for SDK major versions and their underlying dependencies, see the following in the AWS SDKs and Tools Shared Configuration and Credentials Reference Guide:

Getting started

To get started working with the SDK setup your project for Go modules, and retrieve the SDK dependencies with go get. This example shows how you can use the v2 SDK to make an API request using the SDK's Amazon DynamoDB client.

Initialize Project
$ mkdir ~/helloaws
$ cd ~/helloaws
$ go mod init helloaws
Add SDK Dependencies
$ go get github.com/aws/aws-sdk-go-v2/aws
$ go get github.com/aws/aws-sdk-go-v2/config
$ go get github.com/aws/aws-sdk-go-v2/service/dynamodb
Write Code

In your preferred editor add the following content to main.go

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(aws.ToString(tableName))
    }
}
Compile and Execute
$ go run .
Table:
tableOne
tableTwo

Getting Help

Please use these community resources for getting help. We use the GitHub issues for tracking bugs and feature requests.

  • Ask a question on StackOverflow and tag it with the aws-sdk-go tag.
  • Come join the AWS SDK for Go community chat on gitter.
  • Open a support ticket with AWS Support.
  • If you think you may have found a bug, please open an issue.

This SDK implements AWS service APIs. For general issues regarding the AWS services and their limitations, you may also take a look at the Amazon Web Services Discussion Forums.

Opening Issues

If you encounter a bug with the AWS SDK for Go we would like to hear about it. Search the existing issues and see if others are also experiencing the issue before opening a new issue. Please include the version of AWS SDK for Go, Go language, and OS you’re using. Please also include reproduction case when appropriate.

The GitHub issues are intended for bug reports and feature requests. For help and questions with using AWS SDK for Go please make use of the resources listed in the Getting Help section. Keeping the list of open issues lean will help us respond in a timely manner.

Feedback and contributing

The v2 SDK will use GitHub Issues to track feature requests and issues with the SDK. In addition, we'll use GitHub Projects to track large tasks spanning multiple pull requests, such as refactoring the SDK's internal request lifecycle. You can provide feedback to us in several ways.

GitHub issues. To provide feedback or report bugs, file GitHub Issues on the SDK. This is the preferred mechanism to give feedback so that other users can engage in the conversation, +1 issues, etc. Issues you open will be evaluated, and included in our roadmap for the GA launch.

Gitter channel. For more informal discussions or general feedback, check out our Gitter channel for the SDK. The Gitter channel is also a great place to ask general questions, and find help to get started with the 2.0 SDK Developer Preview.

Contributing. You can open pull requests for fixes or additions to the AWS SDK for Go 2.0 Developer Preview release. All pull requests must be submitted under the Apache 2.0 license and will be reviewed by an SDK team member before being merged in. Accompanying unit tests, where possible, are appreciated.

Resources

SDK Developer Guide - Use this document to learn how to get started and use the AWS SDK for Go V2.

SDK API Reference Documentation - Use this document to look up all API operation input and output parameters for AWS services supported by the SDK. The API reference also includes documentation of the SDK, and examples how to using the SDK, service client API operations, and API operation require parameters.

Service Documentation - Use this documentation to learn how to interface with AWS services. These guides are great for getting started with a service, or when looking for more information about a service. While this document is not required for coding, services may supply helpful samples to look out for.

Forum - Ask questions, get help, and give feedback

Issues - Report issues, submit pull requests, and get involved (see Apache 2.0 License)

Expand ▾ Collapse ▴

Documentation

Overview

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

aws-sdk-go-v2 is the Developer Preview for the v2 of the AWS SDK for the Go programming language. Look for additional documentation and examples to be added.

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(aws.ToString(tableName))
    }
}

Source Files

Directories

Path Synopsis
aws Package aws provides the core SDK's utilities and shared types.
aws/arn Package arn provides a parser for interacting with Amazon Resource Names.
aws/middleware
aws/protocol/ec2query
aws/protocol/query
aws/protocol/restjson
aws/protocol/xml
aws/ratelimit
aws/retry Package retry provides interfaces and implementations for SDK request retry behavior.
aws/retry/internal/mock
aws/signer/internal/v4
aws/signer/v4 Package v4 implements signing for AWS V4 signer Provides request signing for request that need to be signed with AWS V4 Signatures.
aws/transport/http
internal/awstesting
internal/awstesting/unit Package unit performs initialization and validation for unit tests
internal/awsutil
internal/endpoints
internal/ini Package ini is an LL(1) parser for configuration files.
internal/rand
internal/sdk
internal/sdkio
internal/shareddefaults
internal/strings
internal/sync/singleflight Package singleflight provides a duplicate function call suppression mechanism.
internal/timeconv
MODULE config
MODULE credentials
MODULE ec2imds
MODULE example/service/s3/listObjects
MODULE feature/cloudfront/sign
MODULE feature/dynamodb/attributevalue
MODULE feature/dynamodb/expression
MODULE feature/dynamodbstreams/attributevalue
MODULE feature/ec2/imds
MODULE feature/s3/manager
MODULE internal/protocoltest/awsrestjson
MODULE internal/protocoltest/ec2query
MODULE internal/protocoltest/jsonrpc
MODULE internal/protocoltest/jsonrpc10
MODULE internal/protocoltest/query
MODULE internal/protocoltest/restxml
MODULE internal/repotools
MODULE internal/repotools/changes
MODULE service/accessanalyzer
MODULE service/acm
MODULE service/acmpca
MODULE service/alexaforbusiness
MODULE service/amplify
MODULE service/apigateway
MODULE service/apigatewaymanagementapi
MODULE service/apigatewayv2
MODULE service/appconfig
MODULE service/appflow
MODULE service/applicationautoscaling
MODULE service/applicationdiscoveryservice
MODULE service/applicationinsights
MODULE service/appmesh
MODULE service/appstream
MODULE service/appsync
MODULE service/athena
MODULE service/autoscaling
MODULE service/autoscalingplans
MODULE service/backup
MODULE service/batch
MODULE service/braket
MODULE service/budgets
MODULE service/chime
MODULE service/cloud9
MODULE service/clouddirectory
MODULE service/cloudformation
MODULE service/cloudfront
MODULE service/cloudhsm
MODULE service/cloudhsmv2
MODULE service/cloudsearch
MODULE service/cloudsearchdomain
MODULE service/cloudtrail
MODULE service/cloudwatch
MODULE service/cloudwatchevents
MODULE service/cloudwatchlogs
MODULE service/codeartifact
MODULE service/codebuild
MODULE service/codecommit
MODULE service/codedeploy
MODULE service/codeguruprofiler
MODULE service/codegurureviewer
MODULE service/codepipeline
MODULE service/codestar
MODULE service/codestarconnections
MODULE service/codestarnotifications
MODULE service/cognitoidentity
MODULE service/cognitoidentityprovider
MODULE service/cognitosync
MODULE service/comprehend
MODULE service/comprehendmedical
MODULE service/computeoptimizer
MODULE service/configservice
MODULE service/connect
MODULE service/connectparticipant
MODULE service/costandusagereportservice
MODULE service/costexplorer
MODULE service/databasemigrationservice
MODULE service/dataexchange
MODULE service/datapipeline
MODULE service/datasync
MODULE service/dax
MODULE service/detective
MODULE service/devicefarm
MODULE service/directconnect
MODULE service/directoryservice
MODULE service/dlm
MODULE service/docdb
MODULE service/dynamodb
MODULE service/dynamodbstreams
MODULE service/ebs
MODULE service/ec2
MODULE service/ec2instanceconnect
MODULE service/ecr
MODULE service/ecs
MODULE service/efs
MODULE service/eks
MODULE service/elasticache
MODULE service/elasticbeanstalk
MODULE service/elasticinference
MODULE service/elasticloadbalancing
MODULE service/elasticloadbalancingv2
MODULE service/elasticsearchservice
MODULE service/elastictranscoder
MODULE service/emr
MODULE service/eventbridge
MODULE service/firehose
MODULE service/fms
MODULE service/forecast
MODULE service/forecastquery
MODULE service/frauddetector
MODULE service/fsx
MODULE service/gamelift
MODULE service/glacier
MODULE service/globalaccelerator
MODULE service/glue
MODULE service/greengrass
MODULE service/groundstation
MODULE service/guardduty
MODULE service/health
MODULE service/honeycode
MODULE service/iam
MODULE service/identitystore
MODULE service/imagebuilder
MODULE service/inspector
MODULE service/internal/accept-encoding
MODULE service/internal/benchmark
MODULE service/internal/integrationtest
MODULE service/internal/presigned-url
MODULE service/internal/s3shared
MODULE service/iot
MODULE service/iot1clickdevicesservice
MODULE service/iot1clickprojects
MODULE service/iotanalytics
MODULE service/iotdataplane
MODULE service/iotevents
MODULE service/ioteventsdata
MODULE service/iotjobsdataplane
MODULE service/iotsecuretunneling
MODULE service/iotsitewise
MODULE service/iotthingsgraph
MODULE service/ivs
MODULE service/kafka
MODULE service/kendra
MODULE service/kinesis
MODULE service/kinesisanalytics
MODULE service/kinesisanalyticsv2
MODULE service/kinesisvideo
MODULE service/kinesisvideoarchivedmedia
MODULE service/kinesisvideomedia
MODULE service/kinesisvideosignaling
MODULE service/kms
MODULE service/lakeformation
MODULE service/lambda
MODULE service/lexmodelbuildingservice
MODULE service/lexruntimeservice
MODULE service/licensemanager
MODULE service/lightsail
MODULE service/machinelearning
MODULE service/macie
MODULE service/macie2
MODULE service/managedblockchain
MODULE service/marketplacecatalog
MODULE service/marketplacecommerceanalytics
MODULE service/marketplaceentitlementservice
MODULE service/marketplacemetering
MODULE service/mediaconnect
MODULE service/mediaconvert
MODULE service/medialive
MODULE service/mediapackage
MODULE service/mediapackagevod
MODULE service/mediastore
MODULE service/mediastoredata
MODULE service/mediatailor
MODULE service/migrationhub
MODULE service/migrationhubconfig
MODULE service/mobile
MODULE service/mq
MODULE service/mturk
MODULE service/neptune
MODULE service/networkmanager
MODULE service/opsworks
MODULE service/opsworkscm
MODULE service/organizations
MODULE service/outposts
MODULE service/personalize
MODULE service/personalizeevents
MODULE service/personalizeruntime
MODULE service/pi
MODULE service/pinpoint
MODULE service/pinpointemail
MODULE service/pinpointsmsvoice
MODULE service/polly
MODULE service/pricing
MODULE service/qldb
MODULE service/qldbsession
MODULE service/quicksight
MODULE service/ram
MODULE service/rds
MODULE service/rdsdata
MODULE service/redshift
MODULE service/redshiftdata
MODULE service/rekognition
MODULE service/resourcegroups
MODULE service/resourcegroupstaggingapi
MODULE service/robomaker
MODULE service/route53
MODULE service/route53domains
MODULE service/route53resolver
MODULE service/s3
MODULE service/s3control
MODULE service/s3outposts
MODULE service/sagemaker
MODULE service/sagemakera2iruntime
MODULE service/sagemakerruntime
MODULE service/savingsplans
MODULE service/schemas
MODULE service/secretsmanager
MODULE service/securityhub
MODULE service/serverlessapplicationrepository
MODULE service/servicecatalog
MODULE service/servicediscovery
MODULE service/servicequotas
MODULE service/ses
MODULE service/sesv2
MODULE service/sfn
MODULE service/shield
MODULE service/signer
MODULE service/sms
MODULE service/snowball
MODULE service/sns
MODULE service/sqs
MODULE service/ssm
MODULE service/sso
MODULE service/ssoadmin
MODULE service/ssooidc
MODULE service/storagegateway
MODULE service/sts
MODULE service/support
MODULE service/swf
MODULE service/synthetics
MODULE service/textract
MODULE service/timestreamquery
MODULE service/timestreamwrite
MODULE service/transcribe
MODULE service/transfer
MODULE service/translate
MODULE service/waf
MODULE service/wafregional
MODULE service/wafv2
MODULE service/workdocs
MODULE service/worklink
MODULE service/workmail
MODULE service/workmailmessageflow
MODULE service/workspaces
MODULE service/xray