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

Configurable AWS endpoint #12369

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
2 changes: 2 additions & 0 deletions x-pack/functionbeat/_meta/beat.reference.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
# Configure functions to run on AWS Lambda, currently we assume that the credentials
# are present in the environment to correctly create the function when using the CLI.
#
# Configure which S3 endpoint should we use.
functionbeat.provider.aws.endpoint: "s3.amazonaws.com"
# Configure which S3 bucket we should upload the lambda artifact.
functionbeat.provider.aws.deploy_bucket: "functionbeat-deploy"

Expand Down
2 changes: 2 additions & 0 deletions x-pack/functionbeat/_meta/beat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
# Configure functions to run on AWS Lambda, currently we assume that the credentials
# are present in the environment to correctly create the function when using the CLI.
#
# Configure which S3 endpoint should we use.
functionbeat.provider.aws.endpoint: "s3.amazonaws.com"
# Configure which S3 bucket we should upload the lambda artifact.
functionbeat.provider.aws.deploy_bucket: "functionbeat-deploy"

Expand Down
7 changes: 7 additions & 0 deletions x-pack/functionbeat/docs/config-options.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ the events to {es}.

["source","sh",subs="attributes"]
----
{beatname_lc}.provider.aws.endpoint: "s3.amazonaws.com"
{beatname_lc}.provider.aws.deploy_bucket: "functionbeat-deploy"
{beatname_lc}.provider.aws.functions:
- name: cloudwatch
Expand Down Expand Up @@ -56,6 +57,12 @@ to deploy.
TIP: If you change the configuration after deploying the function, use
the <<update-command,`update` command>> to update your deployment.

[float]
[id="{beatname_lc}-endpoint"]
==== `provider.aws.endpoint`

AWS endpoint to use in the URL template to load functions.

[float]
[id="{beatname_lc}-deploy-bucket"]
==== `provider.aws.deploy_bucket`
Expand Down
1 change: 1 addition & 0 deletions x-pack/functionbeat/docs/getting-started.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ events from CloudWatch Logs and forwards the events to {es}.

["source","sh",subs="attributes"]
-------------------------------------------------------------------------------------
{beatname_lc}.provider.aws.endpoint: "s3.amazonaws.com"
{beatname_lc}.provider.aws.deploy_bucket: "functionbeat-deploy"
{beatname_lc}.provider.aws.functions:
- name: cloudwatch
Expand Down
2 changes: 2 additions & 0 deletions x-pack/functionbeat/functionbeat.reference.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
# Configure functions to run on AWS Lambda, currently we assume that the credentials
# are present in the environment to correctly create the function when using the CLI.
#
# Configure which S3 endpoint should we use.
functionbeat.provider.aws.endpoint: "s3.amazonaws.com"
# Configure which S3 bucket we should upload the lambda artifact.
functionbeat.provider.aws.deploy_bucket: "functionbeat-deploy"

Expand Down
2 changes: 2 additions & 0 deletions x-pack/functionbeat/functionbeat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
# Configure functions to run on AWS Lambda, currently we assume that the credentials
# are present in the environment to correctly create the function when using the CLI.
#
# Configure which S3 endpoint should we use.
functionbeat.provider.aws.endpoint: "s3.amazonaws.com"
# Configure which S3 bucket we should upload the lambda artifact.
functionbeat.provider.aws.deploy_bucket: "functionbeat-deploy"

Expand Down
1 change: 1 addition & 0 deletions x-pack/functionbeat/provider/aws/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import (

// Config expose the configuration option the AWS provider.
type Config struct {
Endpoint string `config:"endpoint" validate:"nonzero,required"`
DeployBucket bucket `config:"deploy_bucket" validate:"nonzero,required"`
}

Expand Down
4 changes: 3 additions & 1 deletion x-pack/functionbeat/provider/aws/template_builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ type templateData struct {
type defaultTemplateBuilder struct {
provider provider.Provider
log *logp.Logger
endpoint string
bucket string
}

Expand All @@ -53,6 +54,7 @@ func NewTemplateBuilder(log *logp.Logger, cfg *common.Config, p provider.Provide
return &defaultTemplateBuilder{
provider: p,
log: log,
endpoint: config.Endpoint,
bucket: string(config.DeployBucket),
}, nil
}
Expand Down Expand Up @@ -101,7 +103,7 @@ func (d *defaultTemplateBuilder) execute(name string) (templateData, error) {

templateChecksum := checksum(templateJSON)
templateKey := keyPrefix + name + "/" + templateChecksum + "/cloudformation-template-create.json"
templateURL := "https://" + d.bucket + "s3.amazonaws.com/" + templateKey
templateURL := "https://" + d.bucket + "." + d.endpoint + "/" + templateKey

return templateData{
json: templateJSON,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ functionbeat.provider.local:
{% endif %}

{% if cloudwatch %}
functionbeat.provider.aws.endpoint: {{ cloudwatch.endpoint | default("s3.amazonaws.com") }}
functionbeat.provider.aws.deploy_bucket: {{ cloudwatch.bucket | default("functionbeat-deploy") }}
functionbeat.provider.aws.functions:
- name: {{ cloudwatch.name }}
Expand Down