Kittovski
Kittovski

Reputation: 187

AWS EB deploy from docker TypeError

I'm trying to deploy my code from inside a docker instance using the AWS Elasticbeanstalk CLI. I get this error:

    $ eb deploy my-env
Traceback (most recent call last):
  File "/usr/local/bin/eb", line 11, in <module>
    sys.exit(main())
  File "/usr/local/lib/python2.7/dist-packages/ebcli/core/ebcore.py", line 142, in main
    ebrun.run_app(app)
  File "/usr/local/lib/python2.7/dist-packages/ebcli/core/ebrun.py", line 74, in run_app
    io.log_error(e.__class__.__name__ + " - " + e.message)
TypeError: cannot concatenate 'str' and 'ProfileNotFound' objects

My config.yml looks like this:

branch-defaults:
  default:
    environment: null
    group_suffix: null
  master:
    environment: my-env
global:
  application_name: myapp
  branch: null
  default_ec2_keyname: null
  default_platform: Docker 18.03.1-ce
  default_region: eu-west-2
  include_git_submodules: true
  instance_profile: null
  platform_name: null
  platform_version: null
  profile: eb-cli
  repository: null
  sc: git
  workspace_type: Application

Upvotes: 2

Views: 1024

Answers (3)

MillerC
MillerC

Reputation: 731

Update to anyone looking at this after 2019 try not to pass credentials in the docker container, pass IAM permissions through a task definition role

https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task_definition_parameters.html#container_definition_environment

When you register a task definition, you can provide a task role for an IAM role that allows the containers in the task permission to call the AWS APIs that are specified in its associated policies on your behalf. For more information, see IAM Roles for Tasks. - https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task-iam-roles.html

Upvotes: 0

progfan
progfan

Reputation: 2536

The problem is that there are no AWS credentials in ~/.aws/credentials inside the container. Your Dockerfile needs to do add something like the following to ~/.aws/credentials before an eb deploy:

[eb-cli]
aws_access_key_id = <AWS_ACCESS_KEY_ID>
aws_secret_access_key = <AWS_SECRET_ACCESS_KEY>

Upvotes: 4

Andrei Dascalu
Andrei Dascalu

Reputation: 1177

Would you be able to provide some extra details regarding your environment? If I understand correctly have installed ewscli in a docker container then started the container, connected to it and try to run the deploy from there.

Could you please tell me: - what's your python version? - inside the container, do you have a default AWS profile configured ?

Upvotes: 0

Related Questions