Integrations with Amazon Web Services

March 9, 2017

Integrations with Amazon Web Services

Of all supported Buddy integrations one of the most popular are Amazon Web Services. There are currently 5 AWS services supported by dedicated actions with more to come in the future (depending on the community feedback):

Deploy to Amazon S3

Together with Elastic Beanstalk and EC2, one the most successful Amazon service. A lot of web developers use S3 to store static files (sometimes entire static pages). With Buddy, you can define a pipeline that will automatically upload repository files to the selected S3 Bucket on push to branch. You can add additional actions that will process your files prior to the deployment, eg. Grunt or Gulp.

Example pipeline:

The project is PHP. Static assets, such as videos, PDFs, Javascript, CSS and image files are kept in an S3 bucket. On every push to the master branch Buddy will test and upload your website to the SFTP server + and update assets on AWS S3.

Deploy to Elastic Beanstalk

AWS Elastic Beanstalk is a classic PaaS service, similar to Heroku or Google App Engine. It lets developers upload, build and serve their code, leaving infrastructure configuration and scaling at the AWS side.

Example pipeline:

Deployment to Elastic Beanstalk is based on uploading a zip file with the application code. Buddy lets you create a pipeline that will upload the package automatically on push, on demand, or recurrently at a given time. Just like with S3, you can add build and test actions before the deployment.

You can also Dockerize your apps first and deploy them Elastic Beanstalk later:

Build and push Docker image to ECR

Amazon EC2 Container Registry is a Docker image storage for AWS developers.

Example pipeline:

To build a Docker image, you need a repository with the application code and a dockerfile with instructions how the image should be built. You can configure Buddy to build a new Docker image and push it to the ECR on every push to the selected branch. It's also possible to add an SSH action that will pull the Docker image on the selected host and launch the new version of the application.

You can read more about building Docker images in this article

Selecting ECR registry in Docker image build actionSelecting ECR registry in Docker image build action

Run Lambda function

AWS Lambda allows developers run code without provisioning servers. It scales to the size of the application and execute only when required, from a couple of requests per day to thousands of operations per second. With Buddy, you can automate deployment of Lambda functions to S3 buckets or trigger the functions with a dedicated Lambda action.

Example pipeline:

Let's assume we have a web application with backend executed in Lambda functions. Both backend and frontend is stored in the same repository. The pipeline for that could look like this:

  1. Build and test application on every push to repo
  2. If all tests have passed, use Lambda function to perform backup
  3. Deploy application frontend to SFTP server
  4. Upload updated backend files to Amazon S3 with another Lambda function

TableMain of Lambda actionTableMain of Lambda action

Deploy to CodeDeploy

CodeDeploy is a tool that facilitates application deployment to EC2 instances and custom user servers. The whole process boils down to uploading the app to CodeDeploy via S3, with the rest of operations handled entirely by AWS.

Example pipeline

Let's assume we have a Node.js project that requires performing Gulp tasks and tests before the deployment. With Buddy, you can create a pipeline that will, for example, execute all of the above once a day at midnight – provided there were any changes at all in the repository. If one of the actions has failed, a notification with the error description will be sent to the selected Slack channel.

Example Gulp-CodeDeploy-Slack pipelineExample Gulp-CodeDeploy-Slack pipeline

Appendix: AWS Policies required by Buddy

In order to make the AWS actions work properly, you need to define the policies for them. You can find the complete list of policies here.

Share:

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.