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

[BUG] Data Prepper v2.10 & v2.10.1 sink do not use refreshed AWS credentials #5198

Open
am90670 opened this issue Nov 18, 2024 · 0 comments
Open
Assignees
Labels
bug Something isn't working

Comments

@am90670
Copy link

am90670 commented Nov 18, 2024

Describe the bug

The OpenSearch sink in Data Prepper v2.10 & v2.10.1 does not recognise and use refreshed AWS STS credentials to sign requests upon expiration of existing credentials. Data Prepper v2.9 does.

To Reproduce
Steps to reproduce the behaviour:

  1. Create an AWS profile in aws/credentials containing the credentials:
[default]
aws_access_key_id =  ...
aws_secret_access_key = ...
aws_session_token = ...
  1. Create the file pipeline.yaml:
log-forwarding-pipeline:
  source:
    random:
  processor:
    - date:
        from_time_received: true
        destination: "timestamp"
  sink:                           
    - opensearch:
        aws:
          region: ...
        hosts:
          - ...
        insecure: true
        index: "data.prepper.random"
  1. Create the file env:
AWS_CONFIG_FILE=/usr/share/data-prepper/.aws/config
AWS_REGION=...
AWS_PROFILE=default
AWS_SHARED_CREDENTIALS_FILE=/usr/share/data-prepper/.aws/credentials
  1. Launch a container using the Data Prepper image:
podman run -d \
  --env-file $PWD/env \
  -v $PWD/pipeline.yaml:/usr/share/data-prepper/pipelines/pipeline.yaml  \
  -v $PWD/aws:/usr/share/data-prepper/.aws \
  public.ecr.aws/opensearchproject/data-prepper:2.10.1
  1. Replace the credentials in aws/credentials with new ones shortly before they existing expire.

  2. Upon expiration of the of the original credentials Data Prepper will begin reporting:

WARN  org.opensearch.dataprepper.plugins.sink.opensearch.BulkRetryStrategy - Bulk Operation Failed. Number of retries 5. Retrying...
org.opensearch.client.opensearch._types.OpenSearchException: Request failed: [security_exception] The security token included in the request is expired
        at org.opensearch.client.transport.aws.AwsSdk2Transport.parseResponse(AwsSdk2Transport.java:473) ~[opensearch-java-2.8.1.jar:?]
        at org.opensearch.client.transport.aws.AwsSdk2Transport.executeSync(AwsSdk2Transport.java:392) ~[opensearch-java-2.8.1.jar:?]
        at org.opensearch.client.transport.aws.AwsSdk2Transport.performRequest(AwsSdk2Transport.java:192) ~[opensearch-java-2.8.1.jar:?]
        at org.opensearch.client.opensearch.OpenSearchClient.bulk(OpenSearchClient.java:215) ~[opensearch-java-2.8.1.jar:?]
        at org.opensearch.dataprepper.plugins.sink.opensearch.bulk.OpenSearchDefaultBulkApiWrapper.bulk(OpenSearchDefaultBulkApiWrapper.java:19) ~[opensearch-2.10.1.jar:?]
        at org.opensearch.dataprepper.plugins.sink.opensearch.OpenSearchSink.lambda$doInitializeInternal$6(OpenSearchSink.java:276) ~[opensearch-2.10.1.jar:?]
        at org.opensearch.dataprepper.plugins.sink.opensearch.BulkRetryStrategy.handleRetry(BulkRetryStrategy.java:302) ~[opensearch-2.10.1.jar:?]
        at org.opensearch.dataprepper.plugins.sink.opensearch.BulkRetryStrategy.execute(BulkRetryStrategy.java:205) ~[opensearch-2.10.1.jar:?]
        at org.opensearch.dataprepper.plugins.sink.opensearch.OpenSearchSink.lambda$flushBatch$17(OpenSearchSink.java:532) ~[opensearch-2.10.1.jar:?]
        at io.micrometer.core.instrument.composite.CompositeTimer.record(CompositeTimer.java:141) ~[micrometer-core-1.13.0.jar:1.13.0]
        at org.opensearch.dataprepper.plugins.sink.opensearch.OpenSearchSink.flushBatch(OpenSearchSink.java:529) ~[opensearch-2.10.1.jar:?]
        at org.opensearch.dataprepper.plugins.sink.opensearch.OpenSearchSink.doOutput(OpenSearchSink.java:478) ~[opensearch-2.10.1.jar:?]
        at org.opensearch.dataprepper.model.sink.AbstractSink.lambda$output$0(AbstractSink.java:69) ~[data-prepper-api-2.10.1.jar:?]
        at io.micrometer.core.instrument.composite.CompositeTimer.record(CompositeTimer.java:141) ~[micrometer-core-1.13.0.jar:1.13.0]
        at org.opensearch.dataprepper.model.sink.AbstractSink.output(AbstractSink.java:69) ~[data-prepper-api-2.10.1.jar:?]
        at org.opensearch.dataprepper.pipeline.Pipeline.lambda$publishToSinks$5(Pipeline.java:360) ~[data-prepper-core-2.10.1.jar:?]
        at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539) [?:?]
        at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) [?:?]
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) [?:?]
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) [?:?]
        at java.base/java.lang.Thread.run(Thread.java:840) [?:?]

Expected behavior
Data Prepper continues to forward to OpenSearch.

Screenshots

Environment (please complete the following information):

  • Container image: public.ecr.aws/opensearchproject/data-prepper
  • 2.10, 2.10.1

Additional context

In my operational environment, AWS STS credentials are provided and refreshed by an external process. Data Prepper v2.9 recognises the refreshed credentials without the need for a restart.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Development

No branches or pull requests

2 participants