Get started

Get started with Attini.

Install the CLI

The first thing we need to do is install the Attini CLI. The CLI is supported for macOS and Linux. For Windows, we recommend using Windows WSL. The CLI can be installed by running the following command:

/bin/bash -c "$(curl -fsSL https://docs.attini.io/blob/attini-cli/install-cli.sh)"

Verify the installation by running:

attini --version

Optionally, we can enable auto-completion in this shell by running the command:

source <(attini generate-completion)

In order to make auto-completion work in new shells we need to add it to our rc file.

For bash:

echo 'source <(attini generate-completion)' >> ~/.bashrc;

For zsh:

echo 'source <(attini generate-completion)' >> ~/.zshrc;

Install the Framework

Next we need to install the Framework in our AWS Account. First log in to your AWS account. You can verify that you are logged in by running the command:

aws sts get-caller-identity

Now we can install the Framework by running:

attini setup --guided

The –guided option tells the CLI to prompt us for all the information needed for a minimal installation.

We will first be asked if we would like to give Attini admin access when deploying resources. Attini will need different privileges depending on what resource you want to deploy, so using an admin role is convenient. However, you can always configure the roles yourself if you want to be more restrictive.

For the sake of getting started quickly, we will answer Yes(Y).

The next question is if we would like to create a default role for the init-deploy-lambda. This is the lambda that responds to our uploads and creates our deployment plan. It therefore needs access to CloudFormation, StepFunction etc. If we answer No, we will be asked to provide our own role.

So we will answer Yes(Y) here as well.

The next question is if we would like to use a default role for the deployment plans that we create. Like the init-deploy-lambda, the deployment plans will need some access to do its job. What access it needs depends on the kind of tasks you would like the deployment plan to perform. If we answer No we will instead have to specify a role in our deployment plan.

So we answer Yes(Y) here as well.

Lastly we are asked to accept the Attini Licence agreement. If we want to use Attini we have to answer Yes here.

And that’s it! Now the framework is being installed. This included creating quite a few resources and can therefore take a few minutes.


Create a project

Now it’s finally time to create and deploy a distribution 🥳.

First, create a working directory:

mkdir hello-world-project
cd hello-world-project

Now let the Attini CLI create a hello world project for us:

attini init-project hello-world

The project contains a very simple deployment plan, only two steps. The first step will deploy a lambda with an http endpoint that returns a greeting based on the environment we are in. The second step will simply invoke the lambda after it is deployed.

Before we can deploy it we need to create an environment in our AWS account. You can have several environments in the same account, however it is a good idea to have different accounts for different environments. To create an environment called “dev”, run the command:

attini environment create dev

Now let’s package and deploy the distribution. Run the following command from the root of the new project.

attini deploy run .

Because the command points toward a directory the CLI will perform the package command and then deploy the resulting distribution. However, we could also have run:

attini distribution package .

And then run the following command to deploy the packaged distribution.

attini deploy run ./attini_dist/hello-world.zip

Because we only have one environment in the account, we don’t have to specify it in the command.

We will get a prompt asking us to confirm the deployment together with some additional information. If we want to skip this prompt we can include the --force option with the deployment command or set the environment type to “test” (attini environment create dev --env-type test).

image of deployment plan result

And that’s it! The distribution is now being deployed, and we can follow it in the terminal. We can see the output for each step, so both the URL for our hello-world Lambda and the result of the invocation can be seen. Because this is the first time we deploy this distribution we have to create the stack containing the deployment plan as well as our Lambda, meaning it takes a bit longer the first time we deploy. When we make a change and redeploy the distribution only the changed resources need to be updated, meaning it will be much faster.

For more information about the distribution and the steps we used, you can find it here:

  1. Attini concepts
  2. How to work with deployments
  3. How to deploy CloudFormation
  4. How to invoke a Lambda

For more detailed information about the different steps and other features of Attini, please read the documentation.