New feature: AWS CLI

May 10, 2017

New feature: AWS CLI

Every developer in the world knows exactly what AWS is. So does Buddy: it even has a separate section for Amazon services only. You can, for instance, upload a new version of the application to Elastic Beanstalk, deploy files to S3 or launch a Lambda function.

The number of services and possibilities AWS has in hand is impressive – and still growing:

List of AWS servicesList of AWS services

Throughout the past months, we kept on getting loads of requests for new AWS integrations. However, we were not able to serve all use cases you were asking for. Until now: we're happy to deliver a new AWS action with which you'll be able to do almost everything in your Amazon Services.

What AWS CLI actually is

The AWS Command Line Interface (CLI) is a unified tool that lets you manage your AWS services. With just one tool to download and configure, you can control multiple AWS services from the command line and automate them through scripts.

The general idea is simple: you install AWS CLI on any computer, authorize with your AWS account, and use it to manage your account, start/stop your instance, upload code, and much more – all directly from the terminal.

Location of AWS CLILocation of AWS CLI

How it works in Buddy

Using the AWS CLI action in Buddy is pretty simple. Upon adding it for the first time, you'll be asked for API credentials. The best way is to create an IAM User with policies required to execute the action.

Once you do that, a window will appear where you can choose the region in which the commands will be run. You can provide your AWS commands in the main window at the top.

TableMain of AWS CLITableMain of AWS CLI

Use case – Updating Lambda's function code

You can use AWS CLI, for example, to automatically update your Lambda's code on every push to the selected branch in the repository. Here's how:

  1. Upload the function's code to the repository
  2. Add a pipeline that will be run automatically on every push to the defined branch

    Setting pipeline detailsSetting pipeline details

  3. Add a build action that will zip our file:

     zip -r LambdaFunction.js
  4. Add the AWS CLI action with the following commands

    aws lambda update-function-code --function-name LambdaFunction --zip-file fileb://
    v=`aws lambda publish-version --function-name LambdaFunction | jq -r .Version`
    aws lambda update-alias --function-name LambdaFunction --function-version $v --name PROD

The whole pipeline should look like this:

Pipeline overviewPipeline overview

Now, make a push to the branch and watch Buddy automatically execute your scripts. Enjoy unlimited possibilities of AWS CLI!


Alexander Kus

Alexander Kus

Customer Success Manager

A story-teller and conversation-lover, Alexander decided to invest his skills to help his friends at Buddy transform the cold language of patch notes into exciting narratives. Also: an avid gamer, hip-hop DJ, Liverpool FC fan, absentminded husband, and the father of two.