AWS Cloud Operations & Migrations Blog

Accelerate Modernization using AWS Migration Hub Refactor Spaces and AWS Proton

Refactoring legacy applications and infrastructure can be daunting. From navigating legacy codebase, identifying domains to decompose, where to start, what patterns to adopt, teams can quickly find themselves paralyzed even before they start.

AWS Migration Hub Refactor Spaces is the new starting point for incremental app refactor that makes it easy to manage the refactoring an application while operating in production. However, creating a refactoring environment is only one of many challenges to be solved in a modernization journey, as running and operating microservices at scale can be challenging.

There are operational and technical decisions that you have make for a microservices environment like compute, Continuous Integration/Continuous Deployment (CI/CD) and reducing manual processes that slow down your deployment velocity. AWS Proton helps platform engineers amplify their impact by implementing a scalable self-service platform for developers, resulting in higher velocity for development and deployment processes throughout an application lifecycle.

This post provides guidance on how to accelerate modernizing your current monolith by refactoring to microservices. We will also build a self-service platform for developers with built-in guard rails and best practices. To build this, we will use Refactor Spaces and AWS Proton. Let’s get started.

What is Refactor Spaces?

Refactor Spaces addresses a common set of customer problems when refactoring applications, such as setting up infrastructure for iterative application refactoring and operating evolving applications at scale. Customers can transform existing applications using patterns like “Strangler-Fig” to decompose their monolith to microservices or “Leave and Layer” to launch new features in microservices with minimal risk to the existing app.

Refactor Spaces helps in taking care of the heavy lifting for adopting patterns mentioned above for refactoring an application.

Challenges faced by Customers After Setting up a Refactoring Environment

Once a refactor environment is created using Refactor Spaces, there are various things to think about for a modern application. Even for setting up a simple microservice, there can be a long list of other services and configurations to think about, including:

  • Compute – Where am I going to run my microservices? Will they be run on traditional EC2, will they use Containers or will they use a serverless model with AWS Lambda?
  • Unified DevOps Platform – Maintaining a consistent way to do CI/CD for microservices and infrastructure at scale can be a challenge. Having a unified DevOps platform which provides a consistent path forward, visibility and control of all your microservices and infrastructure can simplify and accelerate your modernization journey.
  • Logging, Monitoring and Observability – How do I capture logs from all my microservices? How do I get metrics from my infrastructure to see if it is performing as expected? How can I have a dashboard to observe all of my microservices?
  • Management and Governance of Applications – How do I simplify Cloud operations with a large number of microservices? How can I get centralized deployment and update management? How do I create a self-service platform for developers?

What is AWS Proton?

AWS Proton helps solve all of these challenges and increase the pace of innovation by defining, vending and maintaining infrastructure templates for self-service deployment. Using AWS Proton, platform teams in an organization can provide their developers with a highly opinionated platform to deploy their applications on. This allows developers to focus their energy on writing code, rather than spending time on infrastructure. Similarly, platform teams can focus on building reusable templates, based on their defined best practices.

With AWS Proton, Platform Engineers create and register an environment template which defines shared infrastructure resources required to deploy microservices like Virtual Private Cloud (Amazon VPC), Elastic Container Service (Amazon ECS) Clusters and Application Load Balancers. You can then deploy one or more environments based on this environment template, for example, an environment for development, testing and production. Platform teams then create and register service templates which defines application-specific infrastructure.

Service templates can include monitoring, CI/CD resources along with compatible environment templates. We accelerate developer experience by letting developers choose a service template based on their requirements and deploy the service to an environment created by the environment template.

AWS provides over 10+ common application templates in the AWS Proton Template Library for teams to get started quickly with AWS Proton. By using AWS Proton, customers can resolve the challenges faced by them after setting up a refactoring environment. We will now dive into the benefits of using AWS Proton along with Refactor Spaces.

Benefits of using AWS Proton with Refactor Spaces

By provisioning the Microservice Environment with AWS Proton, Platform teams can build the environment and service templates, developers can leverage these templates to build new microservices to decompose the monolith. The benefits of using AWS Proton with Refactor Spaces are:

Accelerated Developer Experience – Accelerate your developers to build microservices faster. Developers can now embrace the “You Build it, You Run it!” model where they can run their applications with ease without bothering Platform teams for deployment or administration work. Developers now can focus on building applications rather than worry about infrastructure and deployment.

Better Platform Team Experience – Make operators life easier by building environment and service templates and maintenance becomes easier. AWS Proton makes it easy for platform teams to identify and update out-of-date infrastructure when templates are updated as AWS

Centralized Operations – Platform teams get Centralized Management and Governance of environments and services provisioned by Proton. Developers get One-Click upgrades to new versions when templates are upgraded

The architecture of our final refactoring environment can be illustrated by the following diagram –

Architecture Diagram for refactoring an application with Refactor Spaces

Figure 1. Architecture Diagram for refactoring an application with Refactor Spaces.


Here are the high-level steps to create this solution:

  1. Create an Environment, Application and then Service in Refactor Spaces
  2. Create an environment template and Environment in AWS Proton
  3. Create a Service Template in AWS Proton
  4. Create a Repository Connection and CI/CD Service Role in AWS Proton
  5. Create a Service in AWS Proton
  6. Create a Service to route in Refactor Spaces to microservice


You should have the following resources before you start this walkthrough:

  1. AWS Accounts for your monolith and microservice
  2. Monolith Application running on AWS
  3. Microservice to run on AWS Proton
  4. Source Code Repository for your microservice

Get Started

To get started, create a Refactor Spaces Environment and Route to your monolith as described in this post. Next, navigate to AWS Proton using the AWS Management Console.

Create Environment Template in AWS Proton

Click on environment templates from the left menu and Create environment template. An environment template helps in deploying an environment for your microservices with the parameters you choose.

You can create your own environment templates and upload them to Amazon Simple Storage Service (Amazon S3) or use a git repository to sync templates or use one of our sample template bundles. We provide sample template bundles for deploying web services that run on AWS Fargate or a template for deploying services on AWS Lambda.

Environment Template options in AWS Proton

Figure 2. Environment Template options in AWS Proton.

Create Service Template in AWS Proton

Once our environment template is created, we create a service template. A service template helps to deploy a service on to the environment we create. The steps for creating a service template is similar to creating an environment template.

Create an Environment in AWS Proton

When both templates are created, we can create an environment and a service from their respective templates. To create an environment, click on Environments from the left menu and click on Create Environment.

We now have to configure the environment, you can choose if you want AWS to manage your environment, which means that AWS Proton provisions infrastructure for your environment or if you want self-managed provisioning, where a Pull Request is submitted to the linked repository when a change is made.

Next, we choose if are provisioning an environment in this account or another AWS Account. Click on “Another AWS Account” and select the account where you want to create your microservices.
Choose an environment name, select an environment role which will make API calls to services like AWS CloudFormation to provision your infrastructure and then click Next. We now have to select the Amazon VPC CIDR Range and CIDR for the subnets. Click Next to review and create the environment. Proton now provisions an environment for you to deploy your services on.

Create a Repository Connection and CI/CD Pipeline Role in AWS Proton

AWS Proton can link with your existing source code repository to detect code changes for CI/CD for application and infrastructure. To create a repository connection, click on Repositories in the left menu and select your repository provider. You can use an existing CodeStar connection if you have one. We also need to create a pipeline service role which allows AWS Proton to make CloudFormation API calls to deploy a pipeline CloudFormation stack on your behalf.

Create a Service in AWS Proton

Creating a service is similar to creating an environment. To create a service, click on Services from the left menu and click on Create Service. Choose the Service template that you created and click Next.

We now have to configure the service, enter a service name and select the repository connection that you created in the previous step. You will now have to configure the service instance where you can choose the Port to route traffic to, task size, number of Fargate Tasks you would like to run etc.

Configure Service instance in AWS Proton

Figure 3. Configure Service instance in AWS Proton.

Create Service in Refactor Spaces

When your service is up and running on Proton, we now use Refactor Spaces to route to our microservice. To do this, create a service in Refactor Spaces. Select the environment and application that you had created earlier. Choose VPC as the service endpoint type and select the appropriate Amazon VPC. Enter the API endpoint from the service instance in AWS Proton.

Configure Service Endpoint in AWS Proton

Figure 4. Configure Service Endpoint in AWS Proton.

We are now able to route to the microservice provisioned by AWS Proton. We can use this pattern to create new microservices in AWS Proton for refactoring the monolith in Refactor Spaces.

Clean up

From this guide, we built a self-service developer platform with AWS Proton and a refactoring environment with Refactor Spaces. In the following steps, you can clean up the resources you created.

  1. Delete the service by navigating to the AWS Proton console, in the left pane, choose Services. Select your service, choose Actions, Delete.
  2. Similarly, delete the Service Template, Environment and Environment Template in that order.
  3. Delete the refactoring environment by navigating to the Refactor Spaces console.
  4. Select the environment that was created and delete the service from the Services and Routes tab, select the service and click on Delete. Once the Service is deleted, you can delete the application similarly from the Applications tab.
  5. Click on Environments in the left pane, select the environment created and click on Delete.


By following these steps, you can now choose to “leave and layer” or adopt the “Strangler-Fig” pattern to decompose your monolith and also have created a modern self-service platform which your developers and operators can use for simplifying their operations while accelerating developer and platform team experience using AWS Proton. AWS Migration Hub Refactor Spaces and AWS Proton is available in US East, US West (Oregon), Asia Pacific (Tokyo), Europe (Ireland).
To get started with decomposing your monoliths, go to Refactor Spaces under AWS Migration Hub and for accelerating your developers go to AWS Proton.

About the author:

Seshanth Kannappan

Seshanth Kannappan is a Senior Modernization Solutions Architect at AWS. He is currently working with customers to accelerate modernization of their applications and enhance developer productivity. In his free time, he likes to watch live music, theater and try new restaurants in New York City.