Categorygithub.com/asecurityteam/component-aws
modulepackage
0.2.0
Repository: https://github.com/asecurityteam/component-aws.git
Documentation: pkg.go.dev

# README

component-aws - Settings component for AWS clients

GoDoc

Overview

This is a settings component that enables constructing AWS credentials/sessions and some of the clients we regularly use when building services.

Quick Start

package main

import (
    "context"
    "net/http"

    aws "github.com/asecurityteam/component-aws"
    "github.com/aws/aws-sdk-go/service/dynamodb"
    "github.com/asecurityteam/settings"
)

func main() {
    ctx := context.Background()
    envSource := settings.NewEnvSource(os.Environ())

    sess, _ := aws.NewSession(ctx, envSource)
    d := dynamodb.New(sess)
    // or
    db, _ := aws.NewDynamoDB(ctx, envSource)
    // or
    s3 := aws.NewS3(ctx, envSource)
}

Status

This project is in incubation which means we are not yet operating this tool in production and the interfaces are subject to change.

Contributing

Building And Testing

We publish a docker image called SDCLI that bundles all of our build dependencies. It is used by the included Makefile to help make building and testing a bit easier. The following actions are available through the Makefile:

  • make dep

    Install the project dependencies into a vendor directory

  • make lint

    Run our static analysis suite

  • make test

    Run unit tests and generate a coverage artifact

  • make integration

    Run integration tests and generate a coverage artifact

  • make coverage

    Report the combined coverage for unit and integration tests

License

This project is licensed under Apache 2.0. See LICENSE.txt for details.

Contributing Agreement

Atlassian requires signing a contributor's agreement before we can accept a patch. If you are an individual you can fill out the individual CLA. If you are contributing on behalf of your company then please fill out the corporate CLA.

# Functions

LoadDynamoDB is a convenience method for binding the source to the component.
LoadS3 is a convenience method for binding the source to the component.
LoadSession is a convenience method for binding the source to the component.
NewDynamoDB is the top-level entry point for creating a DynamoDB client.
NewDynamoDBComponent generates a default component.
NewS3 is the top-level entry point for creating an S3 client.
NewS3Component generates a default component.
NewSession is the top-level entry point for creating an AWS auth session.
NewSessionComponent constructs a default SessionComponent.

# Structs

AssumeRoleCredentialConfig contains settings for assuming a role.
DynamoDBComponent is used to create a new DynamoDB client.
DynamoDBConfig contains the settings for a DynamoDB client.
S3Component is used to create a new S3 client.
S3Config contains the settings for a S3 client.
SessionComponent implements the Component interface and produces an AWS session object.
SessionConfig contains settings for establishing an authenticated AWS session.
SharedCredentialConfig contains settings for using the AWS shared profile configuration file to authenticate.
StaticCredentialConfig contains settings for using a fixed set of credentials to authenticate.