Skip to main content

Aws Getting Started

This document describes how to get started with GruCloud on AWS.

Use Cases

The following use case diagram depicts an overview of what a Solution Architect/DevOps can perform with GruCloud. usecase.svg

Workflow

While the previous use case diagram shows a high-level description, the next flowchart diagram details the commands to perform to migrate an existing infrastructure to GruCloud, regardless of how the infrastructure was deployed: via the web interface, or via an IaC tool such as Terraform, pulumi or the AWS CDK.

gc-new-workflow

Requirements

  • AWS Account
  • AWS CLI
  • Access and Secret Key

AWS Account

Ensure access to the Amazon Console and create an account if necessary.

AWS CLI

Ensure the AWS CLI is installed and configured:

aws --version

If not, visit https://docs.aws.amazon.com/cli/latest/userguide/install-cliv2.html

Access and Secret Key

Visit the security credentials

  • Click on Access key (access key ID and secret access key).
  • Click on the button Create New Access Key.

Write down the AWSAccessKeyId and AWSSecretKey

In a further episode, the access and secret key will be obtained from a dedicated IAM user with the correct role and policy.

Getting the GruCloud CLI

This chart describes the way to install gc, the GruCloud CLI:

gc-cli-install

GruCloud is written in Javascript running on Node.js. Check if node is present on your system

node --version

The version must be greater than 14

Install the GrucCloud command-line utility gc with npm

npm i -g @grucloud/core

Check the current version of gc:

gc --version

GruCloud CLI

gc new Create a new project

The new command guides you on how to create and configure a new project.

gc-new-aws

Below is the screencast of gc new:

The boilerplate project is now created and configured.

gc list List the live resources

Visualize your current infrastructure with the list command:

gc list --graph

The following diagram is taken from the ec2-vpc example

diagram-live.svg

gc gencode Generate the code

The gencode command fetches the live resources and generate the code in resource.js

gc gencode

The following flowchart explains in more detail the process of generating the code from the live infrastructure.

gc-gencode.svg

At this point, the target infrastructure matches the live infrastructure.

gc graph Target Graph

The graph command creates a dependency graph of the target resources:

gc graph

diagram-live.svg

The graph command requires graphviz to convert the generated artifacts/diagram-target.dot into an image such as artifacts/diagram-target.svg

gc tree Resource mind map

Given the target resources defined in resources.js, let's generate a mindmap of the target resources by group and type with the tree command.

gc tree

diagram-live.svg

gc apply Update

To update the infrastructure, either use the AWS console and run gc gencode, or modify directly the file resource.js. Once done, use the apply command to update the infrastructure:

gc apply

For instance, let's change the EC2 InstanceType from t2.micro to t2.small. The machine will be stopped, its InstanceType changed, and finally, the machine will be started.

gc destroy Destroy

Resources can be destroyed in the right order with the destroy command:

gc destroy

Next Steps