The Internet of Things on AWS – Official Blog

Accelerate Industry 4.0 Adoption using Containerized Gateway Services

As part of the Manufacturing sector’s digitization process, Industry 4.0 automation drives real-time, data acquisition from industrial equipment on the plant floor. This data and immediate feedback have become a mission-critical requirement. In addition, recent supply chain disruptions have increased the lead time to procure edge hardware resulting in several months delays to modernization projects. Some of the most challenging aspects of the modernization process involve setting up device connectivity, establishing multiple communication protocols, and acquiring the right hardware to deploy at scale and across industrial sites. This blog post explains how you can deploy multiple instances of edge software on a single device. In this solution, we deploy one instance for each environment (development and quality) to avoid needing to procure additional hardware for each environment. The edge software that we discuss include AWS IoT SiteWise Edge using AWS IoT Greengrass as the runtime environment and runs in a Docker container. You deploy the software using the AWS Cloud Development Kit (AWS CDK) and the GNU Make utility.


  1. AWS Accounts_ – Two AWS accounts with default Amazon Virtual Private Cloud (Amazon VPC) subnet configuration. The accounts need to have sufficient AWS Identity and Access Management (IAM) permissions to launch Amazon EC2 instances, provision IoT Greengrass devices, and set up AWS IoT SiteWise models and assets. Note that the Amazon Machine Image (AMI) we use in the setup is available only in the Northern Virginia (us-east-1) Region. You will need to copy the AMI for deployment to other Regions.
  2. Install Docker and Docker Compose on your edge gateway device to build and deploy containers.
  3. On your local development machine,
    1. Install and configure the AWS Command Line Interface (AWS CLI) following the steps provided at Set up the AWS CLI.
    2. Install AWS Cloud Development Kit (AWS CDK) to provision cloud resources. Refer to the AWS CDK Workshop to gain hands-on experience using the AWS CDK.
    3. Clone the run-multiple-sitewise-gateways-using-containers sample repo from GitHub following the steps provided at Cloning a repository.

Solution Walkthrough

For demonstration purposes, let’s consider an automotive manufacturing plant with a stamping production line comprising of two stamping presses. You ingest real-time measurement data from each stamping press into two AWS environments (named development and quality) using two instances of the edge software running on the same edge hardware.

First, you simulate temperature and pressure measurement values every 1 second using Ignition software installed on an Amazon Elastic Compute Cloud (Amazon EC2) instance. Next, you create a digital representation of the two stamping presses in AWS IoT SiteWise in both the development and quality environments.

Finally, you prepare the edge gateway device and deploy two instances of AWS IoT SiteWise Edge. You test the end-to-end data flow from the Stamping Presses to AWS IoT SiteWise in both the development and quality environments. Below is the architecture diagram of the solution that we just described:

Architecture Diagram of the Solution


  1. Prepare your environments

Use two AWS accounts to represent the development and quality environments. You can either use existing accounts or create new ones.

Note: Write down the 12-digit AWS account ID for each account as you will need them in the following steps.

   2. Simulate real-time measurement data for industrial equipment

Use the Ignition software to set up an OPC Unified Architecture (OPC UA) simulator server. Install the software on an Amazon EC2 instance, and configure sample tags to simulate temperature and pressure data for the stamping presses.

   2.1 Choose your target environment

Select the environment where you will deploy your cloud resources. First, you choose the AWS account that represents your development environment.

When you return to this section for deploying the solution a second time on the quality environment, select the AWS account that represents your quality environment.

To choose the target environment, update the account and region parameters in the iot-factory-cdk/cdk.json file.

Note: The Community Amazon Machine Image (AMI) for Ignition is currently available only in the us-east-1 Region. If you wish to deploy the solution in another Region, you can copy the AMI using the steps provided at Copy an AMI.

2.2 Install Ignition software

Launch an Amazon EC2 instance and install the Ignition software using AWS CDK. (In a real-world scenario, instead of an Amazon EC2 instance, you could use edge hardware within your factory.)

Change the directory to iot-factory-cdk and issue the following command to deploy a CDK stack, which includes all the resources needed to run Ignition.

cdk deploy OPCUAInstanceStack

Navigate to the AWS CloudFormation Console to verify the deployment and look for a stack named OPCUAInstanceStack.

Cloudformation Ouptut

Note: Write down the EC2IP, EC2PublicIP, and EC2Port parameter values. You will use them in the following steps.

2.3 Configure the Ignition software to simulate data

Now that you have installed Ignition software, let’s configure it to simulate the data for the stamping presses. (In a real-world scenario, Ignition typically collects data from industrial equipment, such as stamping presses, through Programmable Logic Controllers (PLCs).

To configure Ignition, access a web browser. Allow inbound HTTP traffic to the underlying Amazon EC2 instance hosting Ignition by following the instructions at Authorize inbound traffic for your Linux instances. Alternatively, you may consider setting up port forwarding as demonstrated in this blog post to avoid access to the instance from the public IP address by securely create tunnels between your instances.

Launch Ignition using the URL http://<EC2PublicIP> and log in using the default credentials (username: admin, password: password). Replace EC2PublicIP with the value noted in step 2.2.

You may want to change the default credentials following the instructions at Gateway Security before proceeding.

Now, create a data simulator device to represent production line 1 and two stamping presses following the steps below:

  • Navigate to Config > OPC UA > Device Connections.
  • Create a new device using Create new Device > Programmable Device Simulator > Next and use Production Line 1 as its name. Then, choose Create New Device.
  • Load an existing program to simulate data for temperature and pressure measurements.
    • Choose More > edit program > Load Simulator Program > Load from CSV option.
    • Browse to iot-factory-cdk/iot_factory_cdk/stacks/opcua_datasource /simulator_program_instructions.csv and select Load Simulator Program.
    • Choose Save Program.

Your data simulator device is ready. Ignition begins simulating data for all four measurements every 1 second.

3.Create a digital representation of industrial equipment

Create asset models and assets to digitally represent your stamping line and two stamping presses.

Issue the following command to deploy a CDK stack. This includes all the resources needed from AWS IoT SiteWise.

cdk deploy SiteWiseAssetStack

Verify the AWS IoT SiteWise resources by navigating to the AWS IoT SiteWise consoleAssets. You should see the assets set up as shown in the following screenshot.

Fig: AWS IoT SiteWise console with assets and asset hierarchy displayed

AWS IoT SiteWise console with assets and asset hierarchy displayed

4.Provision the required edge and cloud resources to ingest data from OPC UA Server

Set up the AWS IoT SiteWise Edge Gateway on the edge gateway device and establish connectivity with the Ignition OPC UA server you set up earlier.

Update the iot-factory-cdk/ with the following parameters

  • Environment: Any lowercase string that represents your environment, such as dev.
  • OPCUAIP: The IP address of the OPC UA server. EC2IP from Step 2.2
  • OPCUAPort: The port used for the OPC UA server. This is the Amazon EC2Port from Step 2.2

Use the following commands to deploy the resources:

source iot-factory-cdk/

cdk deploy IotFactoryCdkStack

Verify the deployment by navigating to the [AWS CloudFormation Console]( and looking for a stack named IotFactoryCdkStack

Cloudformation Stack

4.1 Prepare the Docker compose file

Issue the following command to create a Docker compose file.

Ensure you run the script from the same environment where your ran cdk deploy in the prior step.

The python script relies on parameters from the cdk.out, which is a copy of the asset created by AWS CDK. Read more about CDK assets at Assets.

python3 greengrassv2-installation/docker/

Review the docker-compose.yml file that is created undergreengrassv2-installation/dockerdirectory.

The docker-compose file contains a reference to the Docker image for IoT Greengrass v2, along with the necessary configurations such as environment variables, file path for the certificates required for IoT Greengrass v2 to register a core device.

4.2 Build a Docker image and run the container

Note: You must copy the greengrassv2-installation/docker folder to your edge gateway device because it contains the necessary configurations and certificates to register the IoT Greengrass v2 core device.

Issue the following commands on the edge gateway device where the Docker daemon runs. It typically runs on edge hardware in your on-premises data center that has network connectivity with both your data source (Ignition or any OPC UA compatible server) and the AWS Cloud.

Issue the following to build a Docker image

cd greengrassv2-installation/docker/

make build

Run the Docker container

cd greengrassv2-installation/docker/

make start

4.3 Allow incoming traffic to the OPC UA server

Allow incoming connections from the AWS IoT SiteWise gateway (running on the edge gateway device) to the Ignition OPC UA server.

Refer to the Gateway Port Reference to know the ports you must open.

5.Validate the Data Flow

So far, you deployed and configured all the resources needed to collect data from your industrial equipment at edge and send it to AWS IoT SiteWise. Now, test the end-to-end data flow using the AWS IoT SiteWise console.

  • Navigate to AWS IoT SiteWise console > Assets.
  • Navigate to Sample_Site1 > Sample_Area1 > Sample_Line1 > Sample StampingPress1.
  • Switch to the Measurements tab and look for values under the Latest value column.
  • Ensure that you find the real-time temperature and pressure values.
  • Repeat these steps for the Sample StampingPress2 asset.

6.Create a new device simulation for the Quality environment

Repeat steps 2 through 5 in the second AWS account to represent your Quality environment.

Clean up

After you validate the results, you can delete the deployed CDK stacks to avoid incurring additional costs.

  • cdk destroy IotFactoryCdkStack
  • cdk destroy SiteWiseAssetStack
  • cdk destroy OPCUAInstanceStack


In this blog, you learned how to use a single edge gateway device for multiple environments, such as development and quality. This solution avoided the need to dedicate additional hardware to each environment. While completing the process, you deployed multiple instances of the software on the same edge device – one instance for each environment. Using the edge software, you were able to ingest real-time data from an OPC UA server at the edge and send it to AWS IoT SiteWise. To Learn more, checkout AWS IoT SiteWise Resources.

Author biographies

Joyson Neville Lewis is a Sr. IoT Data Architect with AWS Professional Services. Joyson worked as a Software/Data engineer before diving into the Conversational AI and Industrial IoT space. He assists AWS customers to materialize their AI visions using Voice Assistant/Chatbot and IoT solutions.
Raju Gottumukkala is an IoT Specialist Solutions Architect at AWS. Raju helps industrial manufacturers along their smart manufacturing journey. He has helped Fortune 500 enterprises across the energy, life sciences, and automotive industries improve operational efficiency and revenue growth by unlocking true potential of IoT data. Prior to AWS, he worked for Siemens and co-founded dDriven, an Industry 4.0 Data Platform company.
Mihir Pujara is a Software Development Engineer at AWS. Mihir enjoys working on projects and tools that aim to improve the customer experience and currently focuses on developing Industrial IoT Edge Components.
Ashok Padmanabhan is a Sr. IoT Data Architect with AWS Professional Services. Ashok primarily works with Manufacturing and Automotive customers to design and build Industry 4.0 solutions.
Chirag S is an IoT Architect with AWS Professional Services. He helps customers realize their business outcomes through cost-effective problem solving in banking, FMCG, media, and consumer IoT space.