Integrations

How do I integrate Attini with other tooling?

Overview

Attini has two components, the CLI and the Framework. The Attini CLI will package your code and start deployments, and the Attini framework will run the deployments for you.

Because you can install the Attini CLI anywhere, you can manage Attini from anywhere.

The Attini framework has no external dependencies and can provision containers inside your environment, meaning it can run any deployment-tools you need.


Package and deploy from anywhere

With the Attini CLI you can package your code and initiate deployments.

The Attini CLI is installed with a one-line shell command in about 2-5 seconds, and it can be installed on your workstation or your build server. The CLI can be installed on Linux and macOS and supports amd64 and arm64 CPU architectures. For Windows users, we recommend to use WSL to run the CLI.

To deploy your code, the Attini CLI only needs AWS IAM credentials.

Using Attini from other tools

You can easily extend your current toolset with Attini, just install the Attini CLI on your build images/worker nodes.

The Attini CLI will follow/tail your deployments and use Unix exit codes. So when a deployment fails, the CLI will return a non 0 response. The Attini CLI will print deployment progress, logs, and errors as standard output so your logs will end up in the right place.

This means that Attini will fit into your current deployment tools (Github Actions, GitLab Runners, Jenkins, Azure DevOps etc.) out of the box.


Run anything with Attini

The Attini framework is installed in your AWS Account, and it can run on-demand containers and other cloud services within your environments and networks.

So Attini can easily deploy anything you need, for example:

  • IaC (CDK, Terraform, Pulumi).
  • Configuration tools (Ansible, Chef etc.).
  • AWS Services (SSM Documents, Lambda functions).
  • Integration/load tests.
  • SQL and other database tools.
  • etc.

Managed steps and custom logic

With Attini you can deploy any technology, either using one of the standard steps or a customer runner.

Attini has some standard steps for common technologies like SAM, CDK and CloudFormation. We are constantly building support for additional technologies based on feature requests (get in touch here).

Using the Attini Runner, you can run your own scripts on your own image, with a custom IAM role within your VPC so that you can easily deploy any technology you need. The Runner will pre-fetch your files and interact with the deployment pipeline/payload. This makes it is easy to run any code, and integrate different technologies.


CI examples

You can run Attini anywhere, you just need the Attini CLI and AWS Credentials.


Run from your workstation

Open a terminal and run:

attini deploy run . -e dev -cb 

When the deploy run command points to a directory like in the above example, it will do a package and deploy directly.

The -e / --environment option lets you set the target environment.

The -cb / --container-build option lets you package using a container.


Run from GitHub Action

name: Attini example

jobs:
  deploy:
    name: Deploy
    runs-on: ubuntu-latest

    steps:
      - name: Checkout code
        uses: actions/checkout@v3
        with:
          ref: 'main'

      - name: Configure AWS Credentials
        uses: aws-actions/configure-aws-credentials@v2
        with:
          role-to-assume: arn:aws:iam::111111111111:role/GitHubRole
          aws-region: eu-west-1
          role-session-name: DeployFromGithub

      - name: Package and deploy Attini project 
        shell: bash
        run: |
          # Install Attini CLI
          /bin/bash -c "$(curl -fsSL https://docs.attini.io/blob/attini-cli/install-cli.sh)"
          
          # Package the distribution
          attini distribution package .
          
          # Upload to S3
          aws s3 cp attini_dist/hello-world.zip s3://my-repository-bucket/hello-world.zip
          
          # Deploy
          attini deploy run s3://my-repository-bucket/hello-world.zip --environment development           

Find more information on how to configure AWS Credentials for GitHub Actions here.


Run from GitLab Runner

.gitlab-ci.yml
# Use an image with the Attini CLI installed. You can use our own image, or the official Attini CLI image. 
image: public.ecr.aws/attini/attini-cli:latest

stages:
  - Deploy

variables:
      AWS_REGION: eu-west-1
      AWS_ACCOUNT: "111111111111"

deploy:
    stage: Deploy
    before_script:
        # Assume AWS IAM Role
        - >
            export $(printf "AWS_ACCESS_KEY_ID=%s AWS_SECRET_ACCESS_KEY=%s AWS_SESSION_TOKEN=%s"
            $(aws sts assume-role-with-web-identity
            --role-arn "arn:aws:iam::${AWS_ACCOUNT}:role/GitLabRole"
            --role-session-name "DeployFromGitLab-${CI_PROJECT_ID}-${CI_PIPELINE_ID}"
            --web-identity-token $CI_JOB_JWT_V2
            --query 'Credentials.[AccessKeyId,SecretAccessKey,SessionToken]'
            --output text))            
    script:
          # Package the distribution
          attini distribution package .
          
          # Upload to S3
          aws s3 cp attini_dist/hello-world.zip s3://my-repository-bucket/hello-world.zip
          
          # Deploy
          attini deploy run s3://my-repository-bucket/hello-world.zip --environment development

Find more information on how to configure AWS Credentials for GitLab here.


CD examples

The different Attini deployment plan types you can deploy anything.

Learn more about the different types, see our guides


Deploy an AWS CDK project

Find a full example here.

The pipeline (DeploymentPlan) can be written in CloudFormation or using a programming language supported by the Attini CDK constructs.

The following DeploymentPlan will deploy a CDK application.

Resources:
  DeploymentPlan:
    Type: Attini::Deploy::DeploymentPlan
    Properties:
      DeploymentPlan:
        - Name: MyCdkDeploy
          Type: AttiniCdk
          Properties:
            Path: ./
            Diff:
              Enabled: true

When the Diff is enabled, changes will require a manual approval.


Deploy a Terraform project

Attini doesn’t have a managed step for Terraform yet, but we can still use the Attini Runner to manage Terraform deployments using the Terraform CLI.

The Attini runner will provision an ECS task in our AWS account which can run terraform apply for us. The runner automatically:

  1. Download your Terraform files to the ECS task.
  2. Manage input and output so that you can integrate your deployment with other tools like automatic testing or SQL queries.
  3. Stay warm between deployments, making development iteration quick.
Resources:
  DeploymentPlan:
    Type: Attini::Deploy::DeploymentPlan
    Properties:
      DeploymentPlan:
        - Name: TerraformApply
          Type: AttiniRunnerJob
          Properties:
            Commands:  
              - terraform apply -auto-approve -var-file=vars/${TF_WORKSPACE}.tfvars
              - terraform output --json | jq 'map_values(.value)' > ${ATTINI_OUTPUT}