Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update how veneur handles aws credentials. #758

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
* Updated the vendored version of DataDog/datadog-go which adds support for sending metrics to Unix Domain socket. Thanks, [prudhvi](https://github.com/prudhvi)!
* Splunk sink: Downgraded Splunk HEC errors to be logged at warning level, rather than error level. Added a note to clarify that Splunk cluster restarts can cause temporary errors, which are not necessarily problematic. Thanks, [aditya](https://github.com/chimeracoder)!
* Updated the vendored version of github.com/gogo/protobuf which fixes Gopkg.toml conflicts for users of veneur. Thanks, [dtbartle](http://github.com/dtbartle)!
* Updated server.go to use the aws sdk (https://docs.aws.amazon.com/sdk-for-go/api/aws/session/) when the creds are not set in the config.yaml. Thanks, [linuxdynasty](https://github.com/linuxdynasty)!

## Bugfixes
* veneur-prometheus now reports incremental counters instead of cumulative counters. This may cause dramatic differences in the statistics reported by veneur-prometheus. Thanks, [kklipsch-stripe](https://github.com/kklipsch-stripe)!
Expand Down
21 changes: 21 additions & 0 deletions plugins/s3/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,24 @@ S3 Plugin
The S3 plugin archives every flush to S3 as a separate S3 object.

This plugin is still in an experimental state.



# Config Options to connect to S3

Mandatory parameters below.

* aws_s3_bucket: `string`
* aws_region: `string`

Optional parameters below.

* aws_access_key_id `string`
* aws_secret_access_key `string`

The Go AWS SDK will load up Credentials in the following order. https://docs.aws.amazon.com/sdk-for-go/api/aws/session/

1. Environment Variables `AWS_ACCESS_KEY_ID`, `AWS_SECRET_ACCESS_KEY`, `AWS_SESSION_TOKEN`, `AWS_PROFILE`, `AWS_REGION`
2. Shared Credentials file `~/.aws/credentials`
3. Shared Configuration file (if SharedConfig is enabled) `export AWS_SDK_LOAD_CONFIG=1`
4. EC2 Instance Metadata (credentials only).
36 changes: 20 additions & 16 deletions server.go
Original file line number Diff line number Diff line change
Expand Up @@ -684,28 +684,32 @@ func NewFromConfig(logger *logrus.Logger, conf Config) (*Server, error) {
awsID := conf.AwsAccessKeyID
awsSecret := conf.AwsSecretAccessKey
if conf.AwsS3Bucket != "" {
var sess *session.Session
var err error
if len(awsID) > 0 && len(awsSecret) > 0 {
sess, err := session.NewSession(&aws.Config{
sess, err = session.NewSession(&aws.Config{
Region: aws.String(conf.AwsRegion),
Credentials: credentials.NewStaticCredentials(awsID, awsSecret, ""),
})
} else {
sess, err = session.NewSession(&aws.Config{
Region: aws.String(conf.AwsRegion),
})
}

if err != nil {
logger.Infof("error getting AWS session: %s", err)
svc = nil
} else {
logger.Info("Successfully created AWS session")
svc = s3.New(sess)
plugin := &s3p.S3Plugin{
Logger: log,
Svc: svc,
S3Bucket: conf.AwsS3Bucket,
Hostname: ret.Hostname,
}
ret.registerPlugin(plugin)
}
if err != nil {
logger.Infof("error getting AWS session: %s", err)
svc = nil
} else {
logger.Info("AWS S3 credentials not found. S3 plugin is disabled.")
logger.Info("Successfully created AWS session")
svc = s3.New(sess)
plugin := &s3p.S3Plugin{
Logger: log,
Svc: svc,
S3Bucket: conf.AwsS3Bucket,
Hostname: ret.Hostname,
}
ret.registerPlugin(plugin)
}
} else {
logger.Info("AWS S3 bucket not set. Skipping S3 Plugin initialization.")
Expand Down