{"id":19121152,"url":"https://github.com/maticnetwork/terraform-polygon-supernets","last_synced_at":"2026-06-04T17:30:15.503Z","repository":{"id":145418072,"uuid":"615009918","full_name":"maticnetwork/terraform-polygon-supernets","owner":"maticnetwork","description":null,"archived":false,"fork":false,"pushed_at":"2024-07-24T18:35:59.000Z","size":434,"stargazers_count":32,"open_issues_count":10,"forks_count":23,"subscribers_count":10,"default_branch":"main","last_synced_at":"2025-01-03T08:21:25.868Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"HCL","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/maticnetwork.png","metadata":{"files":{"readme":"docs/README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-03-16T19:08:10.000Z","updated_at":"2024-10-30T21:26:26.000Z","dependencies_parsed_at":"2025-01-03T08:21:00.504Z","dependency_job_id":"f6aea286-d824-44f0-9363-c6c6db7246a4","html_url":"https://github.com/maticnetwork/terraform-polygon-supernets","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maticnetwork%2Fterraform-polygon-supernets","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maticnetwork%2Fterraform-polygon-supernets/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maticnetwork%2Fterraform-polygon-supernets/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maticnetwork%2Fterraform-polygon-supernets/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/maticnetwork","download_url":"https://codeload.github.com/maticnetwork/terraform-polygon-supernets/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240177048,"owners_count":19760308,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-09T05:16:14.736Z","updated_at":"2026-06-04T17:30:15.438Z","avatar_url":"https://github.com/maticnetwork.png","language":"HCL","funding_links":[],"categories":[],"sub_categories":[],"readme":"This repository contains Terraform automation for testing a deployment of Polygon Supernet infrastructure on AWS.\n\n\u003e [!IMPORTANT]\n\u003e Do not use the Automation as-is for production deployments. Please follow HA best practices and the [hardware configuration requirements](https://wiki.polygon.technology/docs/supernets/operate/supernets-requirements/)\n\n# Polygon Supernets AWS Deployment using Terraform / Ansible\n\nPolygon Supernets is Polygon's solution to build and power dedicated\napp-chains. Supernets are powered by Polygon's cutting-edge EVM\ntechnology, industry-leading blockchain tools and premium end-to-end\nsupport.\n\nTo find out more about Polygon, visit the [official\nwebsite](https://polygon.technology/polygon-supernets).\n\n## Official Documentation 📝\n\nIf you'd like to learn more about the Polygon Supernets, how it works\nand how you can use it for your project, please check out the\n**[Polygon Supernets\nDocumentation](https://wiki.polygon.technology/docs/supernets/)**.\n\n## Architecture Overview\n\nThe following resources will be deployed using Terraform:\n\n- Dedicated VPC\n- 4 validator nodes (which are also bootnodes)\n- 1 rootchain (L1) node running Geth\n- Application Load Balancer used for exposing the `JSON-RPC` endpoint\n\n![Architecture Diagram](architecture.png)\n\n\n## Requirements\n\nIn order to use these automations, you'll need a few things installed:\n\n| Name | Version |\n|------|---------|\n| \u003ca name=\"requirement_terraform\"\u003e\u003c/a\u003e [terraform](https://developer.hashicorp.com/terraform/tutorials/aws-get-started/install-cli) | \u003e= 1.4.4 |\n| [Session Manager Plugin](https://docs.aws.amazon.com/systems-manager/latest/userguide/session-manager-working-with-install-plugin.html) | |\n| \u003ca name=\"requirement_aws\"\u003e\u003c/a\u003e [aws cli](https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html) | \u003e= 2.11.0 |\n| \u003ca name=\"requirement_ansible\"\u003e\u003c/a\u003e [ansible](https://docs.ansible.com/ansible/latest/installation_guide/intro_installation.html) | \u003e= 2.14 |\n| \u003ca name=\"requirement_boto3\"\u003e\u003c/a\u003e [boto3](https://pypi.org/project/boto3/) | \u003e= 1.26 |\n| \u003ca name=\"requirement_botocore\"\u003e\u003c/a\u003e [botocore](https://pypi.org/project/botocore/) | \u003e= 1.29 |\n\n\n## Terraform Deployment Steps\n\n1. First, you'll want to clone the project repository and change\n   directories:\n\n```\ngit clone git@github.com:maticnetwork/terraform-polygon-supernets.git\ncd terraform-polygon-supernets\n```\n\n2. Now we'll need to make sure our command line is capable of\n   executing AWS commands. To utilize AWS services, you must set up\n   your AWS credentials. There are two methods to establish these\n   credentials: using the AWS CLI or manually configuring them in your\n   AWS console. For more information about setting up AWS credentials, check\n   out the documentation provided by AWS\n   [here](https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-getting-started.html).\n\n   You can use `aws configure`, `aws configure sso`, or set appropriate variables in\n   `~/.aws/credentials` or in `~/.aws/config`. Alternatively, you can directly set\n   access keys as shown below.\n\n```\n$ export AWS_ACCESS_KEY_ID=AKIAIOSFODNN7EXAMPLE\n$ export AWS_SECRET_ACCESS_KEY=wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY\n$ export AWS_DEFAULT_REGION=eu-west-1\n```\n\nNote: Ensure that the AWS user role has the necessary permissions to create all\nresources listed in the `/modules` directory.\n\nBefore proceeding, verify that your AWS CLI is properly authenticated.\nExecute the following command: `aws sts get-caller-identity`.\nIf the command runs successfully, you are ready to continue.\n\n\n3. There are a few environment variables that should be set before\n   provisioning the infrastructure. Customize `example.env` based on\n   your requirements and then run the commands below to set your local\n   environment variables.\n\n```\nset -a\nsource example.env\nset +a\n```\n\nTo verify that your environment variables have been\nset correctly, run the command `env | grep -i tf_var`.\nThis will display the environment variables, allowing you to confirm they match the values specified in `example.env`.\n\nThe full list of variables that can be configured are in\n[variables.tf](./variables.tf).\n\n4. Now we'll run `terraform init` to download and install the provider\n   plugins, which are used to interact with AWS and initialize the\n   backend to store the state file.\n\n```\nterraform init\n```\n\n5. Next, we're going to \"plan\" and \"apply\" using Terraform. While working\n   iteratively on your Supernet, you'll typically make changes to the\n   Terraform modules, preview the potential infrastructure modifications,\n   and then apply the changes if they meet your expectations.\n\n```\nterraform plan\nterraform apply\n```\n\n6. While applying the Terraform configuration, a private key was generated to grant you\n   access to your VMs. To save this key, use the\n   following commands.\n\n```\nterraform output pk_ansible \u003e ~/devnet_private.key\nchmod 600 ~/devnet_private.key\n```\n\nBy now, the necessary AWS infrastructure for operating a Supernet should be deployed.\nIt's a good time to sign in to your AWS Console and examine the setup.\n\n## Ansible Deployment Steps\n\nAt this stage we'll be using Ansible to configure the VMs that we just\ndeployed with Terraform.\n\n1. To begin, switch your working directory to the Ansible folder\n   `ansible`.\n\n```\ncd ansible\n```\n\n2. The Ansible playbooks that we use require certain external\n   dependencies. In order to retrieve these collections, you can run\n   the following command:\n\n```\nansible-galaxy install -r requirements.yml\n```\n\n3. In case you've altered your region, company name, or deployment name, remember to\n   modify the `inventory/aws_ec2.yml` file accordingly.\n\n```\nregions:\n  - eu-west-1\n###\nfilters:\n  tag:BaseDN: \"\u003cYOUR_DEPLOYMENT_NAME\u003e.edge.\u003cYOUR_COMPANY\u003e.private\"\n```\n\nThe ssh configuration used by Ansible assumes that your default\nprofile will be configured for the same region where your VMs are\ndeployed. You can run `aws configure get region` and confirm that the\ndefault matches your inventory location.\n\n4. The `group_vars/all.yml` file contains a number of values that are\n   often adjusted during Supernet deployments. At the very least,\n   make sure to update the `clean_deploy_title` to match\n   the deployment name you used.\n\n   Other values like `block_gas_limit` and `block_time`\n   significantly impact performance and should be set with care.\n\n5. To verify the availability of your instances, run the following command:\n\n```\nansible-inventory --graph\n```\n\nThis command will list a bunch of instances. At this stage, it's important\nto ensure that your SSM and SSH configurations allow access\nto these instances based on their instance IDs. To test SSM,\nexecute a command similar to the one below:\n\n```\naws ssm start-session --target [aws instance id]\n```\n\nAn example instance id is `i-0641e8ff5f2a31647`. When you run this\ncommand, you should have shell access to your VM.\n\n\n6. Now that we've confirmed access to our VMs, we must verify that the instances are accessible by Ansible.\n   Attempt running this command:\n\n```\nansible all -m ping\n```\n\n\n7. Run ansible playbook\n```\nansible-playbook site.yml\n```\n\nAfter the **full playbook runs, you should have a functional\nSupernet**. If you want perform some tests, you can obtain your public RPC\nendpoint with the following command:\n\n```\nterraform output aws_lb_ext_domain\n```\n\nBy default, we are pre-funding this address:\n`0x85da99c8a7c2c95964c8efd687e95e632fc533d6` which has the private key\n`0x42b6e34dc21598a807dc19d7784c71b2a7a01f6480dc6f58258f78e539f1a1fa`. Using\nthat private key and the RPC address from the previous step you should\nbe able to send transactions. The command below uses\n[cast](https://book.getfoundry.sh/cast/) to send a test transaction:\n\n\n```\ncast send --legacy \\\n    --rpc-url http://ext-rpc-devnet13-edge-10623089.eu-west-1.elb.amazonaws.com \\\n    --value 1 \\\n    --private-key 0x42b6e34dc21598a807dc19d7784c71b2a7a01f6480dc6f58258f78e539f1a1fa \\\n    0x9f34dCBECFC0BD4c1ee3d12e1Fb5DCF1A0b9BCcB\n```\n\nThis command uses\n[polycli](https://github.com/maticnetwork/polygon-cli) to do a simple\nload test. We're not required to specify a private key here because\n`0x42b6e34dc21598a807dc19d7784c71b2a7a01f6480dc6f58258f78e539f1a1fa`\nis the default load test address of `polycli`:\n\n```\npolycli loadtest --chain-id 1 --mode t --requests 10 \\\n    --verbosity 601 http://ext-rpc-devnet13-edge-10623089.eu-west-1.elb.amazonaws.com\n```\n\n## Destroy Procedure 💥\n\nIn the root directory, run `terraform destroy`\n\n\n\u003c!-- ## Quick Deployment --\u003e\n\n\u003c!-- This is a 1-click way to set up the network. The steps below and the --\u003e\n\u003c!-- comments in run.sh describe what each command is for. If running in to --\u003e\n\u003c!-- errors and need troubleshooting, each line from the file should be run --\u003e\n\u003c!-- line-by-line to better identify issues. --\u003e\n\n\u003c!-- Run `run.sh` --\u003e\n\n\u003cbr\u003e\n\n# Supernet Set Up\nTake a look at [Supernet Set Up](./supernet-setup.md)\n\n# Load Testing\nTake a look at [Load Testing](./loadtesting.md)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaticnetwork%2Fterraform-polygon-supernets","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmaticnetwork%2Fterraform-polygon-supernets","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaticnetwork%2Fterraform-polygon-supernets/lists"}