Skip to content

Can using access and secret key to login in aws account #28667

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

Closed
matheusrosmaninho opened this issue Oct 27, 2023 · 15 comments
Closed

Can using access and secret key to login in aws account #28667

matheusrosmaninho opened this issue Oct 27, 2023 · 15 comments

Comments

@matheusrosmaninho
Copy link

Component(s)

exporter/awss3

Is your feature request related to a problem? Please describe.

I would like enter the credentials of AWS for login in account

Describe the solution you'd like

The credential are optional, if don't use don't need pass nothing

Describe alternatives you've considered

No response

Additional context

No response

@matheusrosmaninho matheusrosmaninho added enhancement New feature or request needs triage New item requiring triage labels Oct 27, 2023
@github-actions
Copy link
Contributor

Pinging code owners:

See Adding Labels via Comments if you do not have permissions to add labels yourself.

@crobert-1
Copy link
Member

From the README there's a link that explains how to specify credentials to AWS. This looks like the best practice for accomplishing what you want.

Can you share why it would be better to specify credentials in the config file instead of how it's currently done?

@matheusrosmaninho
Copy link
Author

From the README there's a link that explains how to specify credentials to AWS. This looks like the best practice for accomplishing what you want.

Can you share why it would be better to specify credentials in the config file instead of how it's currently done?

Hi,
I'm using the container otel/opentelemetry-collector-contrib and need describe the credentials in the config.yaml

I tried copy ~/.aws folder inside the container, but doesn't work
I tried create the environment AWS_PROFILE, doesn't work too

If you could have the option of putting the credentials in the file, it would be a solution. Equals the other parameters

image

@crobert-1
Copy link
Member

I believe you can accomplish this by passing environment variables into your docker container.

Are you passing the environment variables (AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, and AWS_SESSION_TOKEN) into the container?

@matheusrosmaninho
Copy link
Author

In the aws sdk for go the default login use the environment AWS_PROFILE and read ~/.aws/credentials file

I tried copy ~/.aws folder inside the container, but doesn't work
I tried create the environment AWS_PROFILE, doesn't work too

image

@crobert-1
Copy link
Member

It looks like there are some ways to mount the credentials file if required, or specify the environment variables. Here's a stack overflow thread on this.

@matheusrosmaninho
Copy link
Author

In the code I can't pass the access key and secret key. The code get this credentials in default profile

func getSessionConfig(config *Config) *aws.Config {

@crobert-1
Copy link
Member

Can you share your configuration? I might be missing something so it would help to know exactly how you're trying to run the collector in a container. The collector's config file, any kind of dockerfile/CLI command being used would be helpful.

@matheusrosmaninho
Copy link
Author

Sure :)

docker-compose.yml

version: "3.8"
services:
  collector:
    container_name: collector
    build:
      context: .
      args:
        COLLECTOR_VERSION: 0.88.0
    ports:
      - 4318:4318 # OTLP http receiver
      - 4317:4317 # OTLP http receiver
    volumes:
      - ./aws:/.aws
    environment:
      AWS_PROFILE: "default"

Dockerfile

ARG COLLECTOR_VERSION

FROM otel/opentelemetry-collector-contrib:${COLLECTOR_VERSION}

COPY ./otel-collector-config.yaml /etc/otel-collector-config

COPY ./aws ~/.aws

CMD [ "--config=/etc/otel-collector-config" ]

EXPOSE 4317
EXPOSE 4318

Config.yaml

receivers:
  otlp:
    protocols:
      http:
        endpoint: 0.0.0.0:4318
      grpc:
        endpoint: 0.0.0.0:4317


processors:
  batch:
    timeout: 5s

extensions:
  health_check:
  basicauth:
    client_auth:
      username: <grafana_cloud_username>
      password: <grafana_cloud_password>


exporters:
  logging:
    verbosity: detailed

  otlphttp:
    auth:
      authenticator: basicauth
    endpoint: <grafana_endpoint>

  awss3:
    s3uploader:
      region: 'us-east-1'
      s3_bucket: 'bucket-teste-otel'
      s3_prefix: 'metric'
      s3_partition: 'minute'

service:
  extensions: [basicauth, health_check]
  pipelines:
    # traces:
    #   receivers: [otlp]
    #   processors: batch
    #   exporters: [otlphttp]

    # metrics:
    #   receivers: [otlp]
    #   processors: batch
    #   exporters: [logging, otlphttp]

    logs:
      receivers: [otlp]
      processors: batch
      exporters: [logging, otlphttp, awss3]

The error message:

image

@crobert-1
Copy link
Member

I'll defer to the code owners at this point since they're the best suited to help. I believe the authentication can be done with the correct mounting path for the aws/credentials file, or adding the right environment variables, but I'll let others add more information here.

@Frapschen Frapschen removed the needs triage New item requiring triage label Oct 31, 2023
Copy link
Contributor

github-actions bot commented Jan 1, 2024

This issue has been inactive for 60 days. It will be closed in 60 days if there is no activity. To ping code owners by adding a component label, see Adding Labels via Comments, or if you are unsure of which component this issue relates to, please ping @open-telemetry/collector-contrib-triagers. If this issue is still relevant, please ping the code owners or leave a comment explaining why it is still relevant. Otherwise, please close it.

Pinging code owners:

See Adding Labels via Comments if you do not have permissions to add labels yourself.

@github-actions github-actions bot added the Stale label Jan 1, 2024
@crobert-1 crobert-1 removed the Stale label Jan 2, 2024
@tkanhe-karini
Copy link

According to https://aws.github.io/aws-sdk-go-v2/docs/configuring-sdk/#specifying-credentials
We can also give environment variables (AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_REGION) in docker environment like this:

docker-compose.yaml

version: '3'

services:
  otel-collector:
    image: otel/opentelemetry-collector-contrib
    volumes:
      - ./otel-collector-config.yaml:/etc/otelcol-contrib/config.yaml
    ports:
      - "4317:4317" # OTLP gRPC receiver
      - "4318:4318" # OTLP http receiver
    environment:
      AWS_ACCESS_KEY_ID: "AK*************"
      AWS_SECRET_ACCESS_KEY: "MA**************"
      AWS_REGION: "us-east-1"

otel-collector-config.yaml

receivers:
  otlp: # the OTLP receiver the app is sending logs to
    protocols:
      grpc:
        endpoint: 0.0.0.0:4317
      http:
        endpoint: 0.0.0.0:4318

processors:
  batch:
    timeout: 10s

exporters:
  awss3:
    s3uploader:
      region: "us-east-1"
      s3_bucket: "otel-traces-test"
      s3_prefix: "traces"
      s3_partition: "minute"
      disable_ssl: true

service:
  pipelines:
    traces:
      receivers: [otlp]
      processors: [batch]
      exporters: [awss3]

@crobert-1
Copy link
Member

@matheusrosmaninho Is there anything else needed for this issue, or can we resolve it?

Copy link
Contributor

This issue has been inactive for 60 days. It will be closed in 60 days if there is no activity. To ping code owners by adding a component label, see Adding Labels via Comments, or if you are unsure of which component this issue relates to, please ping @open-telemetry/collector-contrib-triagers. If this issue is still relevant, please ping the code owners or leave a comment explaining why it is still relevant. Otherwise, please close it.

Pinging code owners:

See Adding Labels via Comments if you do not have permissions to add labels yourself.

@github-actions github-actions bot added the Stale label Apr 29, 2024
Copy link
Contributor

This issue has been closed as inactive because it has been stale for 120 days with no activity.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Jun 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants