Help with AWS cli #26398
-
I been trying to use the AWS cli with github actions. I’m using this workflow https://github.com/actions/aws/tree/master/cli to run an aws s3 sync command. Does anyone have any working examples? Here’s an example of what I been trying: jobs: |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
Personally I would recommend using a python script instead of the AWS CLI action, since the latter is only supported on Linux, and it’s documentation apparently hasn’t been fully updated to reflect the YAML syntax. In fact the last commit was removing the example YAML syntax. I use the boto3 module for Python, which you can get like so - name: Install python modules I then folow up with running a script something like this: - name: Upload artifact shell: bash env: Specifying bash for the shell means you can use the $ syntax for environment variables regardless of platform. Where the script contents look like this: import os bucket_name = os.environ[‘BUCKET_NAME’] path = os.path.join(os.getcwd(), os.environ[‘ARTIFACT_PATTERN’]) This does pre-suppose that you’ve done a checkout of some repository containing your script, otherwise you’d have to find a way to express the python logic directly in the workflow. Also it looks like boto3 doesn’t have a |
Beta Was this translation helpful? Give feedback.
-
AWS officially provide github actions https://github.com/aws-actions/configure-aws-credentials
${{ secrets.YOUR_SECRETS_NAME }} example
|
Beta Was this translation helpful? Give feedback.
-
@mohammed-salam, if it’s still relevant … I’ve created a GitHub Action that installs the AWS CLI on a Linux runner, according to a given version, so you might find it useful - unfor19/install-aws-cli-action This is how you use it -
|
Beta Was this translation helpful? Give feedback.
Personally I would recommend using a python script instead of the AWS CLI action, since the latter is only supported on Linux, and it’s documentation apparently hasn’t been fully updated to reflect the YAML syntax. In fact the last commit was removing the example YAML syntax.
I use the boto3 module for Python, which you can get like so
- name: Install python modules
run: pip install boto3
I then folow up with running a script something like this:
- name: Upload artifact
working-directory: ${{runner.workspace}}/build
shell: bash env:
AWS_ACCESS_KEY_ID: ${{ secrets.aws_access_key_id }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.aws_secret_access…