Skip to main content

Application Environment Tutorial

In this tutorial, you will build out an Environment Provider and Environment for containerized applications. In practice, these actions are typically performed by someone in a Platform Engineer role. This Environment Provider will provide the required infrastructure to run containerized applications in an Elastic Container Service (ECS) cluster. The Environment entity will reference the new Environment Providers and will be used by an Application Developer as a target into which they will deploy their applications and microservices.

Create an Environment Provider

We're going to start with creating a new AWS Environment Provider.

In the default OPA on AWS solution used by this tutorial, the Infrastructure as Code source and CI/CD pipelines responsible for provisioning infrastructure have already been created and reside in a GitLab reference repository.

We'll use an AWS ECS Environment Provider template to provision our AWS Elastic Container Service (ECS) runtime environment.

1. Click the Create.. menu on the left and Choose the AWS ECS Environment Provider template.

2. Provide input parameters to tailor the environment provider resources.

ParameterValueDescription
Nameecs-dev-providerA unique identifier for the environment provider
PrefixecsdevA short prefix used for AWS resource creation
DescriptionA Dev environment provider for containerized applicationsDescribes what the environment provider's purpose will be
OwnerSelect a group from the drop-down list to own the Environment ProviderThe group or user that will be responsible for the entity
AWS Account NumberEnter your 12-digit AWS account idThe AWS account where the environment provider will be created
AWS RegionSelect the same region where you have deployed the OPA on AWS solutionThe AWS region to provision resources in
Environment role arnEnter the ARN of an IAM role with sufficient permission to deploy AWS infrastructure. A sample role named opa-envprovisioning-role was created when deploying the OPA on AWS solution. The ARN format should be similar to arn:aws:iam::{AWS_ACCOUNT_ID}:role/{IAM_ROLE_NAME}The IAM role to be used for provisioning AWS resources in the target account and region
CIDR10.0.0.0/24 (default)The CIDR block to be provisioned for the VPC associated with the ECS cluster to be created

3. Select Next Step and Provide Repository information

In this step we provide information about the git repository where the Environment Provider source files will be published as part of executing the Software Template.

ParameterValueDescription
Host:default valueThe GitLab host name
Owner:default valueThe GitLab namespace where this repository will belong to.
It can be the name of organization, group, subgroup, user, or the project
Repository:ecs-dev-providerThe name for the git repository

4. Select Next Step, review your inputs and select Create.

5. Environment Provider Entity Creation

Upon clicking Create, the template starts executing automated action steps. It gets info from AWS, fetches ECS infrastructure code and other configuration files from the reference repository, updates configuration inside these files, and sets up a new git repository to store the files.

Once this git folder is ready, a CI/CD process will start automatically. It will use the infrastructure code in the git repository to provision your new ECS platform.

Now, let's proceed to the next step to create an environment using the environment provider entity we just created.

Create an Environment

To create an Environment Entity we will use the AWS Environment template from the software catalog section.

1. On the OPA on AWS website, navigate to the Create.. menu. From the list of available templates, choose the AWS Environment template card.

2. Provide input parameters to tailor the environment entity and click Next Step

ParameterValueDescription
Nameecs-devA unique identifier for the environment
Short NameecsdevA short identifier used for identification of environments
DescriptionDevelopment environment for containerized applications deployed to ECSDescribes the purpose of the environment
Environment TypeAWS ECSSpecifies the type of applications that can be deployed and managed in this environment
Deployment Requires ApprovalNoAllows for blocking a CI/CD pipeline until approval is received. This is often set to 'No' for development and test, but 'Yes' for production
OwnerSelect a group from the drop-down list to own the EnvironmentThe group or user that will be responsible for the entity.
Account TypeSingle-accountIndicates whether the environment supports one or more accounts
Region TypeSingle-regionIndicates whether the environment supports one or more regions
CategoryDevelopmentIdentifies the intended purpose of the environment (dev, test, prod, etc)
ClassificationpublicIdentifies visibility of the environment (public-facing, internal-facing, or private)
SystemdemoIdentifies the relationship of this environment to a larger system. This can be used to group environments together.
Hierarchy of the Environment1Value used to determine relative ordering for environments. Typical approaches are to use lower numbers for development and higher numbers for production.
Providersecs-dev-providerSelects one or more environment providers to attach to this environment. In this tutorial, there may only one environment provider available, so the drop-down list is disabled and the available environment provider will be used.

2. Click Next Step and fill in the remaining information:

ParameterValueDescription
Hostdefault valueThe GitLab host name
Ownerdefault valueThe GitLab namespace where this repository will belong to.
It can be the name of organization, group, subgroup, user, or the project
Repositoryecs-devThe name for the git repository

3. Click Next Step and review your inputs. Click Create

4. The template scaffolding action will fetch a catalog-info.yaml file (used to define entities), replace the placeholders with our input we just provided, push the file to a new repo, and register it to the Backstage catalog.

Now that our Environment Entity is created, our developers can discover and point to the it during their app scaffolding process. Let's proceed to the next step and explore the ECS Environment Entity we just created.