Skip to main content

AWS Lambda

You can use Argonaut to deploy your application as a Lambda container image—deploy as a serverless application. You do not need to make any custom configuration in your application for this. Meaning your application will be able to scale up and down, as needed once deployed as a Lambda container using Argonaut.

This document guides you through setting up an automatic deployment for your application as Lambda container using Argonaut.

info

Argonaut currently supports the following Lambda runtimes:

  • Node.js 14
  • Node:latest
  • Python 3.9
  • Go 1.x

Prerequisites

1. Configure your application deployment

You need to configure an application entity in Argonaut that directly maps to the application that you want to deploy.

To configure a new application on Argonaut:

  1. On your Argonaut dashboard, click on Applications on your left pane.

  2. Click the button Deploy on the top right.

Begin deploy

  1. Select your source version control in the Deployment Setup step.

Select GitHub as source

  1. This takes you to the Deployment Details step where you will configure the source code of your new application entity.

    1. Choose your GitHub/GitLab account from the dropdown.
    2. Choose the repository that has your Lambda application.
    3. Choose your branch.
    4. Click Next.
  2. You’ll be taken to the Select Runtime step. Select the Lambda runtime.

  3. Choose your environment. This will be the region and the VPC your Lambda application will be hosted and run on. This region will be where AWS Lambda will dynamically provision resources for your application. You can choose from one of your existing environments or create a new environment by clicking on the + sign.

  4. Configure how your application needs to be built.

    1. Fill in the App Name. This will be your application’s identification on Argonaut.
    2. Choose the Build Method - the Lambda runtime, for your application.
    3. Fill in the port. This is the port on which your application will be hosted when deployed via Argonaut.
    4. Fill the Build Context. If you have a monorepo structure, this would point to the folder containing the service. Else, . or leave blank.
    5. Fill the Install Dependencies Command. For example, in case of a node.js application it will be npm I.
    6. Fill the Build Command depending on your runtime.
    7. Fill the Run Command. For example, in case of a node.js application, it will be npm start.
    8. Fill the Run Command Directory for your application.
  5. Click on More.

  6. Configure Memory Size (MB). Memory Size (MB) directly maps to the Memory (MB) value setting in AWS Lambda. It is the amount of memory available to your Lambda application at runtime. You can increase or decrease the memory and CPU power allocated to your function using the Memory (MB) setting. Read more about this Lambda setting here.

  7. Configure Timeout (s) for your application.

  8. Fill Custom Domain: This is optional. It should be the Amazon Route53 domain entry that needs to be created for this app. When left blank, Argonaut creates a URL on its own for your application.

  9. Click Deploy.

  10. You'll be taken to the Logs page. Argonaut is now doing two things:

    1. Triggering a deployment of your application to the specified URL and in the specified environment.
    2. Setting up your application to be automatically deployed on every code push.

2. Test your configured deployment

Let’s first verify the ongoing deployment. After clicking Deploy, you’ll be taken to the deployment Logs. To check if the deployment was complete, look for the Outputs section in your logs. 1. Your left column should look like the above with Key, Description, Value, etc. listed. 2. When the last line of your logs says success, it means that your deployment is complete. 3. Navigate to your application’s URL. You should see the application running.

Deployment logs

3. Test automatic deployment

To verify that your application gets deployed on every code push: 1. Make a change to your application’s source code repository, and push to remote. 2. Go to the Applications page on the Argonaut dashboard. 3. Click on your application name. 4. Go to its Deployments tab. 5. You should see a deployment running against your commit ID.

Under the hood

So you’ve set up your serverless AWS Lambda application to automatically be deployed whenever new code is pushed to its source code. But what does Argonaut do behind the scenes to make this work?

When you click Deploy:

  1. Argonaut containerizes your application—packages your Lambda code and its dependencies into a Lambda-compatible container image. That also means that you don’t have to containerize using Docker or others.

  2. Argonaut pushes this container image to a new repository in Amazon ECR. Argonaut uses AWS ECR as the default container registry. It is configured to scan each image on push for vulnerabilities. You can view the details of the security scan from your aws console directly.

  3. Argonaut then uses AWS SAM to automate the build and deployment of this container, i.e your Lambda application.