Set AWS Credentials via API

Our Organization used to deploy AWS Environment.

We set AWS credential manually from GUI. But it is troublesome.

I think it is very useful to get create github event and set AWS Permissions via API.

 

 

  • Saori Ota
  • Jul 23 2018
  • Duplicate
API
  • Attach files
  • Admin
    Alexey Klochay commented
    July 25, 2018 14:01

    Thank you for submitting this idea!

    Our AWS Keys settings section is not available on CircleCI 2.0. We suggest configuring AWS CLI via the environment variables as described in the AWS documentation here. It is possible to create environment variables via the API (please see this doc for an example) so using environment variables should help you achieve your goal.

    Please let me know if this helps!

  • Saori Ota commented
    July 28, 2018 01:36

    I try to set command, but get this message.

    `{

      "message" : "You must choose a name for this environment variable"

    }`

     

    I post this command.

    `curl -X POST --header "Content-Type: application/json" -d '[{"Name": "AWS_ACCESS_KEY_ID", "Value":"AKIAIXXXXXXX"}, "Value":"je7MtGbClwBF/2Zp9Utk/h3yCo8nvbireamgpet"}]' --request POST https://circleci.com/api/v1.1/project/github/gh-name/gh-pj-name/envvar?circle-token=<token>`

  • Nathan Dintenfass commented
    July 28, 2018 02:49

    It looks like there may be syntax problem and missing key in your payload -- your data structure has a key called AWS_ACCESS_KEY_ID, but then your other value does not have a NAME field:

    `[
    {"Name": "AWS_ACCESS_KEY_ID", "Value":"AKIAIXXXXXXX"},
    "Value":"je7MtGbClwBF/2Zp9Utk/h3yCo8nvbireamgpet"}
    ]`