如何使用Circleci 2.1将应用程序部署到弹性beantalk

时间:2020-03-30 01:36:32

标签: circleci circleci-2.0

我正在从Travis CI迁移到CircleCI。我将应用程序部署到ElasticBeanstalk时遇到问题。我已经根据他们的文档和研究设置了所有设置。 但是当我尝试部署时,仍然出现此错误。

ERROR: InvalidProfileError - The config profile (eb-cli) could not be found
Error: 
Exited with code exit status 4

此错误意味着需要在CircleCI上为AWS设置环境变量。我做了什么。我什至进入权限设置我的aws权限。 我什至创建了一个脚本来复制我的AWS凭证,但似乎没有任何作用

 AWS_CONFIG_FILE=~/.aws/config

    mkdir ~/.aws
    touch $AWS_CONFIG_FILE
    chmod 600 $AWS_CONFIG_FILE

    echo "[profile eb-cli]"                              > $AWS_CONFIG_FILE
    echo "aws_access_key_id=${AWS_ACCESS_KEY_ID}"         >> $AWS_CONFIG_FILE
    echo "aws_secret_access_key=${AWS_SECRET_ACCESS_KEY}" >> $AWS_CONFIG_FILE

Config.yaml

version: 2
jobs:
  deploy:
    docker:
      - image: circleci/buildpack-deps:stretch
    steps:
      - checkout
      - run: sudo apt-get -y -qq update --assume-yes
      - run: sudo apt-get install python-pip python-dev build-essential --assume-yes
      - run: sudo pip install awsebcli --upgrade
      - run : sudo eb deploy myApp-env
workflows:
  version: 2
  build_and_test:
    jobs:
      - deploy

.elasticbeanstalk / config.yml

branch-defaults:
  develop:
    environment: myApp-env
  master:
    environment: myApp-env
global:
  application_name: myApp
  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
  sc: git

0 个答案:

没有答案