title: How do I get AWS credentials in the AWS ECS docker container?
body: <p>First, I use the server environment:</p>
  
  <ul>
  <li>sever: django + nginx + uwsgi</li>
  <li>cloud: docker + AWS ECS</li>
  <li>logging: AWS CloudWatch log service + watchtower third party app</li>
  </ul>
  
  <p>I am using the watchtower third party app for the AWS CloudWatch log service.
  So, I need to give AWS credential information to the docker container.</p>
  
  <p>When testing locally, <code>docker run -v $ HOME / .aws: /root/.aws --rm -it -p 8080: 80 image_name</code> will connect the local credentials to the volume.</p>
  
  <p>But I don't know how to apply it in AWS ECS.</p>
  
  <blockquote>
    <p><a href="http://docs.aws.amazon.com/AmazonECS/latest/developerguide/ecs-agent-config.html" rel="noreferrer">http://docs.aws.amazon.com/AmazonECS/latest/developerguide/ecs-agent-config.html</a> </p>
  </blockquote>
  
  <p>I am following the above article, and I have written the .aws/ecs.confg file by following above article.</p>
  
  <pre><code>AWS_DEFAULT_REGION=ap-northeast-1
  AWS_ACCESS_KEY_ID=bbbbbbbbb
  AWS_SECRET_ACCESS_KEY=aaaaaaaaaaaa
  </code></pre>
  
  <p>I added command to the Dockerfile likes bello.</p>
  
  <pre><code>COPY        .aws/ecs.config             /etc/ecs/ecs.config
  </code></pre>
  
  <p>However, internal server error occurs when accessing ECS.</p>
  
  <p>I have also tried to assign an "IAM role" to the container when "Task define"
  Even if you create "CloudWatchLogsFullAccess IAM role", nothing appears on the "Task define" creation screen role drop down.</p>
  
  <p>If you have any other way, please help me.</p>
  
  <p>Thank you.</p>
  
  <p>Here is my logging setting. In local tests, logging works normally.</p>
  
  <pre><code>LOGGING = {
      'version': 1,
      'disable_existing_loggers': False,
      'formatters': {
          'verbose': {
              'format': '%(levelname)s %(asctime)s %(module)s %(process)d %(thread)d %(message)s'
          },
          'simple': {
              'format': '%(levelname)s %(message)s'
          },
      },
      'handlers': {
          'watchtower': {
              'level': 'DEBUG',
              'class': 'watchtower.CloudWatchLogHandler',
              'formatter': 'verbose',
          },
          'console': {
              'level': 'INFO',
              'class': 'logging.StreamHandler',
          },
      },
      'loggers': {
          'django': {
              'handlers': ['watchtower', 'console'],
              'level': 'INFO',
              'propagate': True,
          },
          'django.user': {
              'handlers': ['watchtower'],
              'level': DJANGO_LOG_LEVEL,
              'propagate': False,
          },
          'django.partner': {
              'handlers': ['watchtower'],
              'level': DJANGO_LOG_LEVEL,
              'propagate': False,
          },
      }
  }
  </code></pre>