Set up UiPath RPA bots automatically on Amazon EC2 by using AWS CloudFormation
Created by Dr. Rahul Sharad Gaikwad (AWS) and Tamilselvan P (AWS)
Summary
This pattern explains how you can deploy robotic process automation (RPA) bots on Amazon Elastic Compute Cloud (Amazon EC2) instances. It uses an EC2 Image Builder pipeline to create a custom Amazon Machine Image (AMI). An AMI is a preconfigured virtual machine (VM) image that contains the operating system (OS) and preinstalled software to deploy EC2 instances. This pattern uses AWS CloudFormation templates to install UiPath Studio Community edition
As part of this solution, EC2 Windows instances are launched by using the base AMI, and the UiPath Studio application is installed on the instances. The pattern uses the Microsoft System Preparation (Sysprep) tool to duplicate the customized Windows installation. After that, it removes the host information and creates a final AMI from the instance. You can then launch the instances on demand by using the final AMI with your own naming conventions and monitoring setup.
NoteThis pattern doesn’t provide any information about using RPA bots. For that information, see the UiPath documentation |
This pattern provides the following automations and benefits:
Application deployment and sharing: You can build Amazon EC2 AMIs for application deployment and share them across multiple accounts through an EC2 Image Builder pipeline, which uses AWS CloudFormation templates as infrastructure as code (IaC) scripts.
Amazon EC2 provisioning and scaling: CloudFormation IaC templates provide custom computer name sequences and Active Directory join automation.
Observability and monitoring: The pattern sets up Amazon CloudWatch dashboards to help you monitor Amazon EC2 metrics (such as CPU and disk usage).
RPA benefits for your business: RPA improves accuracy because robots can perform assigned tasks automatically and consistently. RPA also increases speed and productivity because it removes operations that don’t add value and handles repetitious activities.
Prerequisites and limitations
Prerequisites
An active AWS account
AWS Identity and Access Management (IAM) permissions for deploying CloudFormation templates
IAM policies to set up cross-account AMI distribution with EC2 Image Builder
Architecture
The administrator provides the base Windows AMI in the
ec2-image-builder.yaml
file and deploys the stack in the CloudFormation console.The CloudFormation stack deploys the EC2 Image Builder pipeline, which includes the following resources:
Ec2ImageInfraConfiguration
Ec2ImageComponent
Ec2ImageRecipe
Ec2AMI
The EC2 Image Builder pipeline launches a temporary Windows EC2 instance by using the base AMI and installs the required components (in this case, UiPath Studio).
The EC2 Image Builder removes all the host information and creates an AMI from Windows Server.
You update the
ec2-provisioning yaml
file with the custom AMI and launch a number of EC2 instances based on your requirements.You deploy the Count macro by using a CloudFormation template. This macro provides a Count property for CloudFormation resources so you can specify multiple resources of the same type easily.
You update the name of the macro in the CloudFormation
ec2-provisioning.yaml
file and deploy the stack.The administrator updates the
ec2-provisioning.yaml
file based on requirements and launches the stack.The template deploys EC2 instances with the UiPath Studio application.
Tools
AWS services
AWS CloudFormation
helps you model and manage infrastructure resources in an automated and secure manner. Amazon CloudWatch
helps you observe and monitor resources and applications on AWS, on premises, and on other clouds. Amazon Elastic Compute Cloud (Amazon EC2
) provides secure and resizable compute capacity in the AWS Cloud. You can launch as many virtual servers as you need and quickly scale them up or down. EC2 Image Builder
simplifies the building, testing, and deployment of virtual machines and container images for use on AWS or on premises. Amazon EventBridge
helps you build event-driven applications at scale across AWS, existing systems, or software as a service (SaaS) applications. AWS Identity and Access Management (IAM) helps you securely control access to AWS resources. With IAM, you can centrally manage permissions that control which AWS resources users can access. You use IAM to control who is authenticated (signed in) and authorized (has permissions) to use resources.
AWS Lambda
is a serverless, event-driven compute service that lets you run code for virtually any type of application or backend service without provisioning or managing servers. You can call Lambda functions from over 200 AWS services and SaaS applications, and pay only for what you use. Amazon Simple Storage Service (Amazon S3)
is a cloud-based object storage service that helps you store, protect, and retrieve any amount of data.. AWS Systems Manager Agent (SSM Agent) helps Systems Manager update, manage, and configure EC2 instances, edge devices, on-premises servers, and virtual machines (VMs).
Code repositories
The code for this pattern is available in the GitHub UiPath RPA bot setup using CloudFormation
Best practices
AWS releases new Windows AMIs each month. These contain the latest OS patches, drivers, and launch agents. We recommend that you use the latest AMI when you launch new instances or when you build your own custom images.
Apply all available Windows or Linux security patches during image builds.
Epics
Task | Description | Skills required |
---|---|---|
Set up an EC2 Image Builder pipeline. |
| AWS DevOps |
View EC2 Image Builder settings. | The EC2 Image Builder settings include infrastructure configuration, distribution settings, and security scanning settings. To view the settings:
NoteAs a best practice, you should make any updates to EC2 Image Builder through the CloudFormation template only. | AWS DevOps |
View the image pipeline. | To view the deployed image pipeline:
| AWS DevOps |
View Image Builder logs. | EC2 Image Builder logs are aggregated in CloudWatch log groups. To view the logs in CloudWatch:
EC2 Image Builder logs are also stored in an S3 bucket. To view the logs in the bucket:
| AWS DevOps |
Upload the UiPath file to an S3 bucket. |
| AWS DevOps |
Task | Description | Skills required |
---|---|---|
Deploy the Count macro. |
If you want to use the console, follow the instructions in the previous epic or in the CloudFormation documentation. | DevOps engineer |
Test the Count macro. | To test the macro's capabilities, try launching the example template that’s provided with the macro.
| DevOps engineer |
Task | Description | Skills required |
---|---|---|
Deploy the Amazon EC2 provisioning template. | To deploy EC2 Image Pipeline by using CloudFormation:
| AWS DevOps |
View Amazon EC2 settings. | Amazon EC2 settings include security, networking, storage, status checks, monitoring, and tags configurations. To view these configurations:
| AWS DevOps |
View the CloudWatch dashboard. |
NoteAfter you provision the stack, it takes time to populate the dashboard with metrics. The dashboard provides these metrics: | AWS DevOps |
View custom metrics for memory and disk usage. |
| AWS DevOps |
View alarms for memory and disk usage. |
| AWS DevOps |
Verify the snapshot lifecyle rule. |
| AWS DevOps |
Task | Description | Skills required |
---|---|---|
Delete the stacks. | When your PoC or pilot project is complete, we recommend that you delete the stacks you created to make sure that you aren’t charged for these resources.
ImportantThe stack deletion operation can't be stopped after it begins. The stack proceeds to the If the deletion fails, the stack will be in the For information about protecting stacks from being accidentally deleted, see Protecting a stack from being deleted in the AWS CloudFormation documentation. | AWS DevOps |
Troubleshooting
Issue | Solution |
---|---|
When you deploy the Amazon EC2 provisioning template, you get the error: Received malformed response from transform 123xxxx::Count. | This is a known issue. (See the custom solution and PR in the AWS CloudFormation macros repository To fix this issue, open the AWS Lambda console and update |
Related resources
GitHub repositories
AWS references
Creating a stack on the AWS CloudFormation console (CloudFormation documentation)
Troubleshooting CloudFormation (CloudFormation documentation)
Monitor memory and disk metrics forAmazon EC2 instances (Amazon EC2 documentation)
How can I use the CloudWatch agent to view metrics for Performance Monitor on a Windows server?
(AWS re:Post article)
Additional references
Setting the Hostname in a SysPreped AMI
(blog post by Brian Beach) How do I make Cloudformation reprocess a template using a macro when parameters change?
(Stack Overflow)