traefik_aws_plugin

package module
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2024 License: MIT Imports: 8 Imported by: 0

README

Traefik AWS Plugin

This is a Traefik middleware plugin which pushes data to and pulls data from Amazon Web Services (AWS) for a Traefik instance running in Amazon Elastic Container Service (ECS).

Configuration

traefik.yml:

providers:
  ecs:
    exposedByDefault: false

experimental:
  plugins:
    aws:
      moduleName: github.com/bluecatengineering/traefik-aws-plugin
      version: v0.2.0

Example labels for a given router:

```text
"traefik.enable" : "true"
"traefik.http.routers.my-router.service" : "noop@internal"
"traefik.http.routers.my-router.rule" : "Host(`aws.myhostexample.io`)"
"traefik.http.routers.my-router.middlewares" : "my-aws"

Services

Local storage

To store objects in a local directory, use the following labels (example):

"traefik.http.middlewares.my-aws.plugin.aws.type" : "local"
"traefik.http.middlewares.my-aws.plugin.aws.directory" : "aws-local-directory"

GET, PUT and POST are supported. POST will append a UUID to the path. There is a Location header in the response.

S3

To store objects in Amazon Simple Storage Service (S3), use the following labels (example):

"traefik.http.middlewares.my-aws.plugin.aws.service" : "s3"
"traefik.http.middlewares.my-aws.plugin.aws.bucket" : "my-bucket"
"traefik.http.middlewares.my-aws.plugin.aws.region" : "us-west-2"
"traefik.http.middlewares.my-aws.plugin.aws.prefix" : "/prefix"
}

Note that prefix must include the leading slash.

PUT and GET are supported. If you make a POST request, a UUID will be generated and the object will be created in the same manner as a PUT request. A Location header is sent back in the response.

When forwarding the request to S3, the plugin sets the following headers:

DynamoDB

Amazon DynamoDB support is pending.

Development

To develop traefik-aws-plugin in a local workspace:

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(_ context.Context, next http.Handler, config *Config, name string) (http.Handler, error)

Types

type AwsPlugin

type AwsPlugin struct {
	// contains filtered or unexported fields
}

func (AwsPlugin) ServeHTTP

func (plugin AwsPlugin) ServeHTTP(rw http.ResponseWriter, req *http.Request)

type Config

type Config struct {
	TimeoutSeconds int
	Service        string

	// S3
	Bucket string
	Prefix string
	Region string

	// Local Directory
	Directory string
}

func CreateConfig

func CreateConfig() *Config

type Service

type Service interface {
	Put(name string, payload []byte, contentType string, rw http.ResponseWriter) ([]byte, error)
	Post(name string, payload []byte, contentType string, rw http.ResponseWriter) ([]byte, error)
	Get(name string, rw http.ResponseWriter) ([]byte, error)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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