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

AWS Credentials for Docker and Rails Application #171

Open
dimitardanailov opened this issue Aug 4, 2022 · 1 comment
Open

AWS Credentials for Docker and Rails Application #171

dimitardanailov opened this issue Aug 4, 2022 · 1 comment

Comments

@dimitardanailov
Copy link

Greetings,

I'd like to discuss what's the best way for passing aws credentials

My application is Ruby on Rails

So far my Dockerfile uses:

# https://docs.aws.amazon.com/xray/latest/devguide/xray-daemon-ecs.html
RUN apt-get update && apt-get install -y --force-yes --no-install-recommends apt-transport-https curl ca-certificates wget && apt-get clean && apt-get autoremove && rm -rf /var/lib/apt/lists/*
RUN wget https://s3.ap-southeast-1.amazonaws.com/aws-xray-assets.ap-southeast-1/xray-daemon/aws-xray-daemon-3.x.deb
RUN dpkg -i aws-xray-daemon-3.x.deb
ENTRYPOINT ["/usr/bin/xray", "--bind=0.0.0.0:2000", "--bind-tcp=0.0.0.0:2000"]
EXPOSE 2000/udp
EXPOSE 2000/tcp

Application setup:

# Gemfile
gem "aws-xray-sdk", "~> 0.13.0"

# config/initializers/aws_xray.rb
Rails.application.config.xray = {
  # default segment name generated by XRay middleware
  name: "webportal",
  patch: %I[net_http aws_sdk],
  # record db transactions as subsegments
  active_record: true
}

What's the best way to pass my aws credentials ?

@willarmiros
Copy link
Contributor

To define credentials for your daemon in a docker container, you can follow these docs: https://docs.aws.amazon.com/xray/latest/devguide/xray-daemon.html#xray-daemon-permissions

Basically you can either expose the AWS creds through environment variables in your Dockerfile or mount the ~/.aws/credentials file in your container.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants