Skip to content

Commit 1bea961

Browse files
committed
Docs. Moved to AWS CloudShell. Corrected formatting.
1 parent cf44b37 commit 1bea961

File tree

13 files changed

+963
-896
lines changed

13 files changed

+963
-896
lines changed

docs/setup-cloud9.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,14 @@
1+
# AWS CloudShell
2+
3+
To begin, ensure you login to your AWS account with permissions to create and modify resources in IAM, EC2, EBS, VPC, S3, KMS, and Secrets Manager.
4+
5+
From the AWS Management Console, open the [AWS CloudShell](https://docs.aws.amazon.com/cloudshell/latest/userguide/welcome.html), a web-based shell environment. If unfamiliar, review the [2-minute YouTube video](https://youtu.be/fz4rbjRaiQM) for an overview and check out [CloudShell with VPC environment](https://docs.aws.amazon.com/cloudshell/latest/userguide/creating-vpc-environment.html) that we'll use to test nodes API from internal IP address space.
6+
7+
Once ready, you can execute the commands to deploy and test blueprints in the CloudShell.
8+
9+
***
10+
# AWS Cloud 9 IS NO LONGER USED (the instructions below will be removed soon, use AWS CloudShell instead)
11+
***
112
# AWS Cloud9 Setup
213

314
Most steps in this repository will need to be performed from a Linux command prompt. An especially convenient way of doing this is to use AWS Cloud9, a cloud-based Integrated Development Environment (IDE). Cloud9 allows you to edit source files and execute commands from an easy-to-use web interface. It comes pre-configured with many of the tools needed for software development, and because it runs in the AWS Cloud, it can be an especially easy way to access other cloud services. One other handy feature is that your Cloud9 instances automatically stop running after a configurable period of inactivity, which helps reduce costs.

lib/bsc/README.md

Lines changed: 102 additions & 93 deletions
Large diffs are not rendered by default.

lib/ethereum/README.md

Lines changed: 101 additions & 94 deletions
Large diffs are not rendered by default.

lib/fantom/README.md

Lines changed: 104 additions & 89 deletions
Large diffs are not rendered by default.

lib/scroll/README.md

Lines changed: 111 additions & 111 deletions
Original file line numberDiff line numberDiff line change
@@ -74,16 +74,20 @@ This is the Well-Architected checklist for Ethereum nodes implementation of the
7474

7575
## Setup Instructions
7676

77-
### Setup Cloud9
77+
### Open AWS CloudShell
7878

79-
We will use AWS Cloud9 to execute the subsequent commands. Follow the instructions in [Cloud9 Setup](../../docs/setup-cloud9.md)
79+
To begin, ensure you login to your AWS account with permissions to create and modify resources in IAM, EC2, EBS, VPC, S3, KMS, and Secrets Manager.
80+
81+
From the AWS Management Console, open the [AWS CloudShell](https://docs.aws.amazon.com/cloudshell/latest/userguide/welcome.html), a web-based shell environment. If unfamiliar, review the [2-minute YouTube video](https://youtu.be/fz4rbjRaiQM) for an overview and check out [CloudShell with VPC environment](https://docs.aws.amazon.com/cloudshell/latest/userguide/creating-vpc-environment.html) that we'll use to test nodes API from internal IP address space.
82+
83+
Once ready, you can run the commands to deploy and test blueprints in the CloudShell.
8084

8185
### Clone this repository and install dependencies
8286

8387
```bash
84-
git clone https://github.com/alickwong/aws-blockchain-node-runners
85-
cd aws-blockchain-node-runners
86-
npm install
88+
git clone https://github.com/alickwong/aws-blockchain-node-runners
89+
cd aws-blockchain-node-runners
90+
npm install
8791
```
8892

8993
### Deploy Single Node
@@ -92,69 +96,66 @@ We will use AWS Cloud9 to execute the subsequent commands. Follow the instructio
9296

9397
2. If you have deleted or don't have the default VPC, create default VPC
9498

95-
```bash
96-
aws ec2 create-default-vpc
97-
```
99+
```bash
100+
aws ec2 create-default-vpc
101+
```
98102

99-
> NOTE:
100-
> You may see the following error if the default VPC already exists: `An error occurred (DefaultVpcAlreadyExists) when calling the CreateDefaultVpc operation: A Default VPC already exists for this account in this region.`. That means you can just continue with the following steps.
103+
> **NOTE:** *You may see the following error if the default VPC already exists: `An error occurred (DefaultVpcAlreadyExists) when calling the CreateDefaultVpc operation: A Default VPC already exists for this account in this region.`. That means you can just continue with the following steps.*
101104
102105
3. Configure your setup
103106

104107
Create your own copy of `.env` file and edit it to update with your AWS Account ID and Region:
105-
```bash
106-
# Make sure you are in aws-blockchain-node-runners/lib/scroll
107-
cd lib/scroll
108-
npm install
109-
pwd
110-
cp ./sample-configs/.env-sample-full .env
111-
nano .env
112-
```
113-
> NOTE:
114-
> Example configuration parameters are set in the local `.env-sample` file. You can find more examples inside `sample-configs` directory.
108+
```bash
109+
# Make sure you are in aws-blockchain-node-runners/lib/scroll
110+
cd lib/scroll
111+
npm install
112+
pwd
113+
cp ./sample-configs/.env-sample-full .env
114+
nano .env
115+
```
116+
> **NOTE:** *Example configuration parameters are set in the local `.env-sample` file. You can find more examples inside `sample-configs` directory.*
115117
116118
4. Deploy common components such as IAM role
117119

118-
```bash
119-
pwd
120-
# Make sure you are in aws-blockchain-node-runners/lib/scroll
121-
npx cdk deploy scroll-common
122-
```
120+
```bash
121+
pwd
122+
# Make sure you are in aws-blockchain-node-runners/lib/scroll
123+
npx cdk deploy scroll-common
124+
```
123125

124-
> IMPORTANT:
125-
> All AWS CDK v2 deployments use dedicated AWS resources to hold data during deployment. Therefore, your AWS account and Region must be [bootstrapped](https://docs.aws.amazon.com/cdk/v2/guide/bootstrapping.html) to create these resources before you can deploy. If you haven't already bootstrapped, issue the following command:
126-
> ```bash
127-
> cdk bootstrap aws://ACCOUNT-NUMBER/REGION
128-
> ```
126+
> **IMPORTANT:** *All AWS CDK v2 deployments use dedicated AWS resources to hold data during deployment. Therefore, your AWS account and Region must be [bootstrapped](https://docs.aws.amazon.com/cdk/v2/guide/bootstrapping.html) to create these resources before you can deploy. If you haven't already bootstrapped, issue the following command:*
127+
> ```bash
128+
> cdk bootstrap aws://ACCOUNT-NUMBER/REGION
129+
> ```
129130
130131
5. Deploy Amazon Managed Blockchain (AMB) Access Ethereum node and wait about 35-70 minutes for the node to sync
131132
132-
```bash
133-
pwd
134-
# Make sure you are in aws-blockchain-node-runners/lib/scroll
135-
npx cdk deploy scroll-ethereum-l1-node --json --outputs-file scroll-ethereum-l1-node.json
136-
```
133+
```bash
134+
pwd
135+
# Make sure you are in aws-blockchain-node-runners/lib/scroll
136+
npx cdk deploy scroll-ethereum-l1-node --json --outputs-file scroll-ethereum-l1-node.json
137+
```
137138
To watch the progress, open the [AMB Web UI](https://console.aws.amazon.com/managedblockchain/home), click the name of your target network from the list (Mainnet, Goerly, etc.) and watch the status of the node to change from `Creating` to `Available`.
138139

139140
6. Deploy Scroll Full Node and wait for another 10-20 minutes for it to sync
140141

141-
```bash
142-
pwd
143-
# Make sure you are in aws-blockchain-node-runners/lib/scroll
144-
npx cdk deploy scroll-single-node --json --outputs-file single-node-deploy.json
145-
```
142+
```bash
143+
pwd
144+
# Make sure you are in aws-blockchain-node-runners/lib/scroll
145+
npx cdk deploy scroll-single-node --json --outputs-file single-node-deploy.json
146+
```
146147
After starting the node you will need to wait for the initial synchronization process to finish.To see the progress, you may use SSM to connect into EC2 first and watch the log like this:
147148

148-
```bash
149-
export INSTANCE_ID=$(cat single-node-deploy.json | jq -r '..|.node-instance-id? | select(. != null)')
150-
echo "INSTANCE_ID=" $INSTANCE_ID
151-
export AWS_REGION=us-east-1
152-
aws ssm start-session --target $INSTANCE_ID --region $AWS_REGION
153-
tail -f /var/log/scroll/error.log
154-
```
149+
```bash
150+
export INSTANCE_ID=$(cat single-node-deploy.json | jq -r '..|.node-instance-id? | select(. != null)')
151+
echo "INSTANCE_ID=" $INSTANCE_ID
152+
export AWS_REGION=us-east-1
153+
aws ssm start-session --target $INSTANCE_ID --region $AWS_REGION
154+
tail -f /var/log/scroll/error.log
155+
```
155156

156157
When the process complete, you will see `L1 message initial sync completed` in the log:
157-
```
158+
```bash
158159
INFO [12-13|08:25:46.095] Syncing L1 messages processed=18,683,700 confirmed=18,775,938 collected=77348 progress(%)=99.509
159160
INFO [12-13|08:25:56.165] Syncing L1 messages processed=18,699,700 confirmed=18,775,938 collected=78100 progress(%)=99.594
160161
INFO [12-13|08:26:06.122] Syncing L1 messages processed=18,709,300 confirmed=18,775,938 collected=79042 progress(%)=99.645
@@ -164,18 +165,19 @@ We will use AWS Cloud9 to execute the subsequent commands. Follow the instructio
164165
INFO [12-13|08:26:46.124] Syncing L1 messages processed=18,755,400 confirmed=18,775,938 collected=84176 progress(%)=99.891
165166
INFO [12-13|08:26:56.120] Syncing L1 messages processed=18,768,200 confirmed=18,775,938 collected=85240 progress(%)=99.959
166167
INFO [12-13|08:27:00.524] L1 message initial sync completed latestProcessedBlock=18,775,938
167-
```
168+
```
168169

169170
7. Test Scroll RPC API
170171
Use curl to query from within the node instance:
171-
```bash
172-
export INSTANCE_ID=$(cat single-node-deploy.json | jq -r '..|.node-instance-id? | select(. != null)')
173-
echo "INSTANCE_ID=" $INSTANCE_ID
174-
export AWS_REGION=us-east-1
175-
aws ssm start-session --target $INSTANCE_ID --region $AWS_REGION
176172

177-
curl -s -X POST -H "Content-Type: application/json" --data '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}' http://localhost:8545
178-
```
173+
```bash
174+
export INSTANCE_ID=$(cat single-node-deploy.json | jq -r '..|.node-instance-id? | select(. != null)')
175+
echo "INSTANCE_ID=" $INSTANCE_ID
176+
export AWS_REGION=us-east-1
177+
aws ssm start-session --target $INSTANCE_ID --region $AWS_REGION
178+
179+
curl -s -X POST -H "Content-Type: application/json" --data '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}' http://localhost:8545
180+
```
179181

180182
### Monitoring
181183
A script on the Scroll node publishes current block and blocks behind metrics to CloudWatch metrics every 5 minutes. When the node is fully synced the blocks behind metric should get to 0, which might take about 1.5 days. To see the metrics:
@@ -185,83 +187,81 @@ A script on the Scroll node publishes current block and blocks behind metrics to
185187

186188
## Clear up and undeploy everything
187189

188-
1. Undeploy all Nodes and Common stacks
190+
Destroy all Nodes and Common stacks
189191

190-
```bash
191-
# Setting the AWS account id and region in case local .env file is lost
192-
export AWS_ACCOUNT_ID=<your_target_AWS_account_id>
193-
export AWS_REGION=<your_target_AWS_region>
194-
195-
pwd
196-
# Make sure you are in aws-blockchain-node-runners/lib/scroll
192+
```bash
193+
# Setting the AWS account id and region in case local .env file is lost
194+
export AWS_ACCOUNT_ID=<your_target_AWS_account_id>
195+
export AWS_REGION=<your_target_AWS_region>
197196

198-
# Undeploy Single Node
199-
npx cdk destroy scroll-single-node
197+
pwd
198+
# Make sure you are in aws-blockchain-node-runners/lib/scroll
200199

201-
# Undeploy AMB Etheruem node
202-
npx cdk destroy scroll-ethereum-l1-node
200+
# Destroy Single Node
201+
npx cdk destroy scroll-single-node
203202

204-
# Delete all common components like IAM role and Security Group
205-
npx cdk destroy scroll-common
206-
```
203+
# Destroy AMB Etheruem node
204+
npx cdk destroy scroll-ethereum-l1-node
207205

208-
2. Follow steps to delete the Cloud9 instance in [Cloud9 Setup](../../doc/setup-cloud9.md)
206+
# Delete all common components like IAM role and Security Group
207+
npx cdk destroy scroll-common
208+
```
209209

210210
## FAQ
211211

212212
1. How to check the logs of the clients running on my Scroll node?
213213

214-
**Note:** In this tutorial we chose not to use SSH and use Session Manager instead. That allows you to log all sessions in AWS CloudTrail to see who logged into the server and when. If you receive an error similar to `SessionManagerPlugin is not found`, [install Session Manager plugin for AWS CLI](https://docs.aws.amazon.com/systems-manager/latest/userguide/session-manager-working-with-install-plugin.html)
215-
216-
```bash
217-
pwd
218-
# Make sure you are in aws-blockchain-node-runners/lib/scroll
214+
> **NOTE:** *In this tutorial we chose not to use SSH and use Session Manager instead. That allows you to log all sessions in AWS CloudTrail to see who logged into the server and when. If you receive an error similar to `SessionManagerPlugin is not found`, [install Session Manager plugin for AWS CLI](https://docs.aws.amazon.com/systems-manager/latest/userguide/session-manager-working-with-install-plugin.html)*
219215
220-
export INSTANCE_ID=$(cat single-node-deploy.json | jq -r '..|.node-instance-id? | select(. != null)')
221-
echo "INSTANCE_ID=" $INSTANCE_ID
222-
export AWS_REGION=us-east-1
223-
aws ssm start-session --target $INSTANCE_ID --region $AWS_REGION
224-
sudo journalctl -o cat -fu scroll
225-
```
216+
```bash
217+
pwd
218+
# Make sure you are in aws-blockchain-node-runners/lib/scroll
219+
220+
export INSTANCE_ID=$(cat single-node-deploy.json | jq -r '..|.node-instance-id? | select(. != null)')
221+
echo "INSTANCE_ID=" $INSTANCE_ID
222+
export AWS_REGION=us-east-1
223+
aws ssm start-session --target $INSTANCE_ID --region $AWS_REGION
224+
sudo journalctl -o cat -fu scroll
225+
```
226226
2. How to check the logs from the EC2 user-data script?
227227

228-
```bash
229-
pwd
230-
# Make sure you are in aws-blockchain-node-runners/lib/scroll
231-
232-
export INSTANCE_ID=$(cat single-node-deploy.json | jq -r '..|.node-instance-id? | select(. != null)')
233-
echo "INSTANCE_ID=" $INSTANCE_ID
234-
export AWS_REGION=us-east-1
235-
aws ssm start-session --target $INSTANCE_ID --region $AWS_REGION
236-
sudo cat /var/log/cloud-init-output.log
237-
```
228+
```bash
229+
pwd
230+
# Make sure you are in aws-blockchain-node-runners/lib/scroll
231+
232+
export INSTANCE_ID=$(cat single-node-deploy.json | jq -r '..|.node-instance-id? | select(. != null)')
233+
echo "INSTANCE_ID=" $INSTANCE_ID
234+
export AWS_REGION=us-east-1
235+
aws ssm start-session --target $INSTANCE_ID --region $AWS_REGION
236+
sudo cat /var/log/cloud-init-output.log
237+
```
238238

239239
3. How can I restart the Scroll service?
240240

241-
``` bash
242-
export INSTANCE_ID=$(cat single-node-deploy.json | jq -r '..|.node-instance-id? | select(. != null)')
243-
echo "INSTANCE_ID=" $INSTANCE_ID
244-
export AWS_REGION=us-east-1
245-
aws ssm start-session --target $INSTANCE_ID --region $AWS_REGION
246-
sudo systemctl status scroll.service
247-
sudo systemctl restart scroll.service
248-
```
241+
``` bash
242+
export INSTANCE_ID=$(cat single-node-deploy.json | jq -r '..|.node-instance-id? | select(. != null)')
243+
echo "INSTANCE_ID=" $INSTANCE_ID
244+
export AWS_REGION=us-east-1
245+
aws ssm start-session --target $INSTANCE_ID --region $AWS_REGION
246+
sudo systemctl status scroll.service
247+
sudo systemctl restart scroll.service
248+
```
249249
4. Where to find the key l2geth directories?
250250

251251
- The directory with binaries is `/home/ubuntu/l2geth-source`.
252252
- The data directory of l2geth agent is `/home/ubuntu/l2geth-source/l2geth-datadir`
253253

254254
5. You can now attach to l2geth?
255255

256-
```bash
257-
sudo - ubuntu
258-
cd /home/ubuntu/l2geth-source/
259-
alias l2geth=./build/bin/geth
260-
l2geth attach "./l2geth-datadir/geth.ipc"
256+
```bash
257+
sudo - ubuntu
258+
cd /home/ubuntu/l2geth-source/
259+
alias l2geth=./build/bin/geth
260+
l2geth attach "./l2geth-datadir/geth.ipc"
261261

262-
> admin.peers.length
263-
14
262+
> admin.peers.length
263+
14
264264

265-
> eth.blockNumber
266-
10000
267-
```
265+
> eth.blockNumber
266+
10000
267+
```

0 commit comments

Comments
 (0)