sdk

package module
v1.30.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 19, 2024 License: Apache-2.0 Imports: 0 Imported by: 1

README

AWS SDK for Go v2

Go Build statusCodegen Build status SDK Documentation Migration Guide 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.20.

Check 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:

Go version support policy

The v2 SDK follows the upstream release policy with an additional six months of support for the most recently deprecated language version.

AWS reserves the right to drop support for unsupported Go versions earlier to address critical security issues.

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

Getting Help

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

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 same 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.

Contributing. You can open pull requests for fixes or additions to the AWS SDK for Go 2.0. 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 Migration Guide - Use this document to learn how to migrate to V2 from the AWS SDK for Go.

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)

Documentation

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)
    }
}

Directories

Path Synopsis
aws
Package aws provides the core SDK's utilities and shared types.
Package aws provides the core SDK's utilities and shared types.
arn
Package arn provides a parser for interacting with Amazon Resource Names.
Package arn provides a parser for interacting with Amazon Resource Names.
defaults
Package defaults provides recommended configuration values for AWS SDKs and CLIs.
Package defaults provides recommended configuration values for AWS SDKs and CLIs.
middleware/private/metrics
Package metrics implements metrics gathering for SDK development purposes.
Package metrics implements metrics gathering for SDK development purposes.
middleware/private/metrics/emf
Package emf implements an EMF metrics publisher.
Package emf implements an EMF metrics publisher.
retry
Package retry provides interfaces and implementations for SDK request retry behavior.
Package retry provides interfaces and implementations for SDK request retry behavior.
signer/v4
Package v4 implements the AWS signature version 4 algorithm (commonly known as SigV4).
Package v4 implements the AWS signature version 4 algorithm (commonly known as SigV4).
config module
credentials module
ec2imds module
example
feature
ec2/imds Module
rds/auth Module
s3/manager Module
internal
auth/smithy
Package smithy adapts concrete AWS auth and signing types to the generic smithy versions.
Package smithy adapts concrete AWS auth and signing types to the generic smithy versions.
awstesting/unit
Package unit performs initialization and validation for unit tests
Package unit performs initialization and validation for unit tests
endpoints/awsrulesfn
Package awsrulesfn provides AWS focused endpoint rule functions for evaluating endpoint resolution rules.
Package awsrulesfn provides AWS focused endpoint rule functions for evaluating endpoint resolution rules.
sdk
sync/singleflight
Package singleflight provides a duplicate function call suppression mechanism.
Package singleflight provides a duplicate function call suppression mechanism.
configsources Module
ini Module
repotools Module
v4a Module
service
account Module
acm Module
acmpca Module
amp Module
amplify Module
apigateway Module
apigatewayv2 Module
appconfig Module
appconfigdata Module
appfabric Module
appflow Module
appmesh Module
apprunner Module
appstream Module
appsync Module
arczonalshift Module
artifact Module
athena Module
auditmanager Module
autoscaling Module
b2bi Module
backup Module
backupgateway Module
backupstorage Module
batch Module
bedrock Module
bedrockagent Module
braket Module
budgets Module
chatbot Module
chime Module
chimesdkvoice Module
cleanrooms Module
cleanroomsml Module
cloud9 Module
cloudcontrol Module
cloudfront Module
cloudhsm Module
cloudhsmv2 Module
cloudsearch Module
cloudtrail Module
cloudwatch Module
codeartifact Module
codebuild Module
codecatalyst Module
codecommit Module
codedeploy Module
codepipeline Module
codestar Module
cognitosync Module
commander Module
comprehend Module
configservice Module
connect Module
connectcases Module
controltower Module
costexplorer Module
databrew Module
dataexchange Module
datapipeline Module
datasync Module
datazone Module
dax Module
deadline Module
detective Module
devicefarm Module
devopsguru Module
directconnect Module
dlm Module
docdb Module
docdbelastic Module
drs Module
dynamodb Module
ebs Module
ec2 Module
ecr Module
ecrpublic Module
ecs Module
efs Module
eks Module
eksauth Module
elasticache Module
emr Module
emrcontainers Module
emrserverless Module
eventbridge Module
evidently Module
finspace Module
finspacedata Module
firehose Module
fis Module
fms Module
forecast Module
forecastquery Module
frauddetector Module
freetier Module
fsx Module
gamelift Module
gamesparks Module
glacier Module
glue Module
grafana Module
greengrass Module
greengrassv2 Module
groundstation Module
guardduty Module
health Module
healthlake Module
honeycode Module
iam Module
identitystore Module
imagebuilder Module
inspector Module
inspector2 Module
inspectorscan Module
iot Module
iotanalytics Module
iotdataplane Module
iotevents Module
ioteventsdata Module
iotfleethub Module
iotfleetwise Module
iotroborunner Module
iotsitewise Module
iottwinmaker Module
iotwireless Module
ivs Module
ivschat Module
ivsrealtime Module
kafka Module
kafkaconnect Module
kendra Module
kendraranking Module
keyspaces Module
kinesis Module
kinesisvideo Module
kms Module
lakeformation Module
lambda Module
launchwizard Module
lexmodelsv2 Module
lexruntimev2 Module
lightsail Module
location Module
lookoutvision Module
m2 Module
macie Module
macie2 Module
mailmanager Module
mediaconnect Module
mediaconvert Module
medialive Module
mediapackage Module
mediastore Module
mediatailor Module
memorydb Module
mgn Module
migrationhub Module
mobile Module
mq Module
mturk Module
mwaa Module
neptune Module
neptunedata Module
neptunegraph Module
nimble Module
oam Module
omics Module
opensearch Module
opsworks Module
opsworkscm Module
organizations Module
osis Module
outposts Module
panorama Module
personalize Module
pi Module
pinpoint Module
pinpointemail Module
pipes Module
polly Module
pricing Module
proton Module
qbusiness Module
qconnect Module
qldb Module
qldbsession Module
quicksight Module
ram Module
rbin Module
rds Module
rdsdata Module
redshift Module
redshiftdata Module
rekognition Module
repostspace Module
resiliencehub Module
robomaker Module
rolesanywhere Module
route53 Module
rum Module
s3 Module
s3control Module
s3outposts Module
sagemaker Module
sagemakeredge Module
savingsplans Module
scheduler Module
schemas Module
securityhub Module
securitylake Module
servicequotas Module
ses Module
sesv2 Module
sfn Module
shield Module
signer Module
sms Module
snowball Module
sns Module
sqs Module
ssm Module
ssmcontacts Module
ssmincidents Module
ssmsap Module
sso Module
ssoadmin Module
ssooidc Module
sts Module
supplychain Module
support Module
supportapp Module
swf Module
synthetics Module
taxsettings Module
textract Module
tnb Module
transcribe Module
transfer Module
translate Module
voiceid Module
vpclattice Module
waf Module
wafregional Module
wafv2 Module
wisdom Module
workdocs Module
worklink Module
workmail Module
workspaces Module
workspacesweb Module
xray Module

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL