New feature: AWS CLI

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:

Image loading...List 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.

Image loading...Location 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.

Image loading...TableMain 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

    Image loading...Setting pipeline details

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

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

    shell
    aws lambda update-function-code --function-name LambdaFunction --zip-file fileb://LambdaFunction.zip 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:

Image loading...Pipeline overview

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

Jarek Dylewski

Jarek Dylewski

Customer Support

A journalist and an SEO specialist trying to find himself in the unforgiving world of coders. Gamer, a non-fiction literature fan and obsessive carnivore. Jarek uses his talents to convert the programming lingo into a cohesive and approachable narration.

May 10th 2017
Share