Skip to content

Commit 11a2ae4

Browse files
authored
Merge pull request #11 from aws-samples/solana
Solana
2 parents 21e8b57 + 4a55805 commit 11a2ae4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+2977
-53
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ data-volume-snpashot*.json
2929
sync-node-deploy*.json
3030
instance-image*.json
3131
rpc-node-deploy*.json
32+
single-node-deploy*.json
33+
ha-nodes-deploy*.json
3234

3335
*.OLD
3436
.env

docs/setup-cloud9.md

Lines changed: 31 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# AWS Cloud9 Setup
22

3-
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 preconfigured 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.
3+
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.
44

55
## Create a Cloud9 environment
66

@@ -14,10 +14,10 @@ Create an instance profile called **Cloud9-Developer-Access**
1414

1515
1. Create role policy definition file
1616

17-
```bash
18-
cat <<EOF > ec2-trust-policy.json
17+
```bash
18+
cat > ec2-trust-policy.json <<EOF
1919
{
20-
"Version": "2012-10-17",
20+
"Version": "2012-10-17",
2121
"Statement": [
2222
{
2323
"Effect": "Allow",
@@ -28,38 +28,38 @@ Create an instance profile called **Cloud9-Developer-Access**
2828
}
2929
]
3030
}
31-
EOF
32-
```
31+
EOF
32+
```
3333

3434
2. Create new IAM role called "Cloud9-Developer-Access" and assign the new role policy
3535

36-
```bash
37-
aws iam create-role \
38-
--role-name Cloud9-Developer-Access \
39-
--assume-role-policy-document file://ec2-trust-policy.json
40-
```
36+
```bash
37+
aws iam create-role \
38+
--role-name Cloud9-Developer-Access \
39+
--assume-role-policy-document file://ec2-trust-policy.json
40+
```
4141

4242
3. Attach AWS Managed policy with AdministratorAccess to the new role
4343

44-
```bash
45-
aws iam attach-role-policy \
46-
--role-name Cloud9-Developer-Access \
47-
--policy-arn arn:aws:iam::aws:policy/AdministratorAccess
48-
```
44+
```bash
45+
aws iam attach-role-policy \
46+
--role-name Cloud9-Developer-Access \
47+
--policy-arn arn:aws:iam::aws:policy/AdministratorAccess
48+
```
4949

5050
4. Create EC2 instance profile
5151

52-
```bash
53-
aws iam create-instance-profile --instance-profile-name Cloud9-Developer-Access
54-
```
52+
```bash
53+
aws iam create-instance-profile --instance-profile-name Cloud9-Developer-Access
54+
```
5555

5656
5. Add the new role to the instance profile
5757

58-
```bash
59-
aws iam add-role-to-instance-profile \
60-
--instance-profile-name Cloud9-Developer-Access \
61-
--role-name Cloud9-Developer-Access
62-
```
58+
```bash
59+
aws iam add-role-to-instance-profile \
60+
--instance-profile-name Cloud9-Developer-Access \
61+
--role-name Cloud9-Developer-Access
62+
```
6363

6464
## Modify Cloud9 IAM role
6565

@@ -90,15 +90,14 @@ aws configure set default.region us-east-2
9090
Install NodeJS v18 and set as the default version
9191

9292
```bash
93-
nvm install 18
94-
nvm use 18
95-
nvm alias default 18
93+
nvm install 16
94+
nvm use 16
95+
nvm alias default 16
9696
```
9797

9898
The AWS CDK includes the CDK Toolkit (also called the CLI), a command line tool for working with your AWS CDK apps and stacks. Install the CDK toolkit
9999

100100
```bash
101-
102101
npm install -g aws-cdk
103102
cdk --version
104103
```
@@ -125,7 +124,7 @@ cdk bootstrap aws://<INSERT_YOUR_AWS_ACCOUNT_NUMBER>/<INSERT_YOUR_AWS_REGION>
125124

126125
2. Delete the instance profile and IAM role
127126

128-
```bash
129-
aws iam delete-instance-profile --instance-profile-name Cloud9-Developer-Access
130-
aws iam delete-role --role-name Cloud9-Developer-Access
131-
```
127+
```bash
128+
aws iam delete-instance-profile --instance-profile-name Cloud9-Developer-Access
129+
aws iam delete-role --role-name Cloud9-Developer-Access
130+
```

lib/constructs/config.interface.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export interface DataVolumeConfig {
1212
throughput: number;
1313
}
1414

15-
interface BaseNodeConfig {
15+
export interface BaseNodeConfig {
1616
instanceType: ec2.InstanceType;
1717
instanceCpuType: ec2.AmazonLinuxCpuType;
1818
}

lib/constructs/constants.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
export const InstanceStoreageDeviceVolumeType = "instance-store";
22
export const NoneValue = "none";
3-
export const VolumeDeviceNames = ["/dev/sdf", "/dev/sdg", "/dev/sdh", "/dev/sdi", "/dev/sdj", "/dev/sdk"]
3+
export const VolumeDeviceNames = ["/dev/sdf", "/dev/sdg", "/dev/sdh", "/dev/sdi", "/dev/sdj", "/dev/sdk"]
4+
export const GibibytesToBytesConversionCoefficient = 1073741824;

lib/constructs/ha-rpc-nodes-with-alb.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,12 @@ import * as albv2 from "aws-cdk-lib/aws-elasticloadbalancingv2";
77
import * as configTypes from "./config.interface";
88
import * as constants from "./constants";
99
import * as nag from "cdk-nag";
10+
import { HealthCheck } from "aws-cdk-lib/aws-appmesh";
1011

1112
export interface HANodesConstructCustomProps {
1213
instanceType: ec2.InstanceType,
1314
dataVolumes: configTypes.DataVolumeConfig[],
15+
rootDataVolumeDeviceName?: string,
1416
machineImage: cdk.aws_ec2.IMachineImage,
1517
role: cdk.aws_iam.IRole,
1618
vpc: cdk.aws_ec2.IVpc,
@@ -19,6 +21,7 @@ export interface HANodesConstructCustomProps {
1921
numberOfNodes: number;
2022
rpcPortForALB: number,
2123
albHealthCheckGracePeriodMin: number;
24+
healthCheckPath? : string;
2225
heartBeatDelayMin: number;
2326
lifecycleHookName: string;
2427
autoScalingGroupName: string;
@@ -35,6 +38,7 @@ export class HANodesConstruct extends cdkContructs.Construct {
3538
const {
3639
instanceType,
3740
dataVolumes,
41+
rootDataVolumeDeviceName,
3842
machineImage,
3943
role,
4044
vpc,
@@ -43,6 +47,7 @@ export class HANodesConstruct extends cdkContructs.Construct {
4347
numberOfNodes,
4448
rpcPortForALB,
4549
albHealthCheckGracePeriodMin,
50+
healthCheckPath,
4651
heartBeatDelayMin,
4752
lifecycleHookName,
4853
autoScalingGroupName,
@@ -51,7 +56,7 @@ export class HANodesConstruct extends cdkContructs.Construct {
5156
let blockDevices: ec2.BlockDevice[] = [
5257
{
5358
// ROOT VOLUME
54-
deviceName: "/dev/xvda",
59+
deviceName: rootDataVolumeDeviceName ? rootDataVolumeDeviceName : "/dev/xvda",
5560
volume: autoscaling.BlockDeviceVolume.ebs(46, {
5661
deleteOnTermination: true,
5762
throughput: 125,
@@ -172,7 +177,7 @@ export class HANodesConstruct extends cdkContructs.Construct {
172177
healthCheck: {
173178
enabled: true,
174179
healthyHttpCodes: "200-299",
175-
path: "/",
180+
path: healthCheckPath ? healthCheckPath : "/",
176181
// In the future, can create a separate service to have a more reliable health check
177182
port: rpcPortForALB.toString(),
178183
unhealthyThresholdCount: 2,

lib/constructs/single-node.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ export interface SingleNodeConstructCustomProps {
99
instanceName: string,
1010
instanceType: ec2.InstanceType,
1111
dataVolumes: configTypes.DataVolumeConfig[],
12+
rootDataVolumeDeviceName?: string,
1213
machineImage: cdk.aws_ec2.IMachineImage,
1314
role: cdk.aws_iam.IRole,
1415
vpc: cdk.aws_ec2.IVpc,
@@ -28,6 +29,7 @@ export class SingleNodeConstruct extends cdkContructs.Construct {
2829
instanceName,
2930
instanceType,
3031
dataVolumes,
32+
rootDataVolumeDeviceName,
3133
machineImage,
3234
role,
3335
vpc,
@@ -45,7 +47,7 @@ export class SingleNodeConstruct extends cdkContructs.Construct {
4547
blockDevices: [
4648
{
4749
// ROOT VOLUME
48-
deviceName: "/dev/xvda",
50+
deviceName: rootDataVolumeDeviceName ? rootDataVolumeDeviceName :"/dev/xvda",
4951
volume: ec2.BlockDeviceVolume.ebs(46, {
5052
deleteOnTermination: true,
5153
encrypted: true,

lib/ethereum/lib/assets/cw-agent.json

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,6 @@
33
"metrics_collection_interval": 60,
44
"run_as_user": "root"
55
},
6-
"logs": {
7-
"logs_collected": {
8-
"files": {
9-
"collect_list": [{
10-
"file_path": "/var/log/cloud-init-output.log",
11-
"log_group_name": "cloud-init-output.log",
12-
"log_stream_name": "{instance_id}"
13-
}, {
14-
"file_path": "/var/log/initial-sync.log",
15-
"log_group_name": "initial-sync.log",
16-
"log_stream_name": "{instance_id}"
17-
}]
18-
}
19-
}
20-
},
216
"metrics": {
227
"aggregation_dimensions": [
238
[

0 commit comments

Comments
 (0)