Skip to content

Commit 8cff6c8

Browse files
authored
Merge pull request #163 from aws-samples/solana
Solana
2 parents 13733e3 + 2aa21ff commit 8cff6c8

File tree

3 files changed

+21
-20
lines changed

3 files changed

+21
-20
lines changed

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

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -75,18 +75,22 @@ export class HANodesConstruct extends cdkContructs.Construct {
7575
}
7676

7777
if (dataVolume.type !== constants.InstanceStoreageDeviceVolumeType){
78-
blockDevices.push(
79-
{
80-
deviceName: constants.VolumeDeviceNames[arrayIndex],
81-
volume: autoscaling.BlockDeviceVolume.ebs(dataVolume.sizeGiB, {
82-
deleteOnTermination: true,
83-
throughput: dataVolume.throughput,
84-
encrypted: true,
85-
iops: dataVolume.iops,
86-
volumeType: autoscaling.EbsDeviceVolumeType[dataVolume.type.toUpperCase() as keyof typeof autoscaling.EbsDeviceVolumeType],
87-
}),
88-
}
89-
)
78+
const volumeType = dataVolume.type.toUpperCase();
79+
const ebsConfig: any = {
80+
deleteOnTermination: true,
81+
encrypted: true,
82+
iops: dataVolume.iops,
83+
volumeType: autoscaling.EbsDeviceVolumeType[dataVolume.type.toUpperCase() as keyof typeof autoscaling.EbsDeviceVolumeType],
84+
};
85+
86+
if (volumeType == 'GP3'){
87+
ebsConfig.throughput = dataVolume.throughput;
88+
}
89+
90+
blockDevices.push({
91+
deviceName: constants.VolumeDeviceNames[arrayIndex],
92+
volume: autoscaling.BlockDeviceVolume.ebs(dataVolume.sizeGiB, ebsConfig)
93+
})
9094
}
9195
});
9296

lib/solana/lib/assets/instance/storage/setup.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ get_all_empty_nvme_disks () {
3232
local unmounted_nvme_disks=()
3333
local sorted_unmounted_nvme_disks
3434

35-
all_not_mounted_nvme_disks=$(lsblk -lnb | awk '{if ($7=="") {print $1}}' | grep nvme)
35+
#The disk will only be mounted when the nvme disk is larger than 100GB to avoid storing blockchain node data directly on the root EBS disk (which is 46GB by default)
36+
all_not_mounted_nvme_disks=$(lsblk -lnb | awk '{if ($7 == "" && $4 > 100000000) {print $1}}' | grep nvme)
3637
all_mounted_nvme_partitions=$(mount | awk '{print $1}' | grep /dev/nvme)
3738
for disk in ${all_not_mounted_nvme_disks[*]}; do
3839
if [[ ! "${all_mounted_nvme_partitions[*]}" =~ $disk ]]; then

lib/solana/lib/assets/user-data-ubuntu.sh

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,22 +31,18 @@ INSTANCE_ID=$(curl -H "X-aws-ec2-metadata-token: $TOKEN" -s http://169.254.169.2
3131
apt-get -yqq update
3232
apt-get -yqq install jq unzip python3-pip chrony
3333

34+
ARCH=$(uname -m)
35+
3436
if [ "$ARCH" == "x86_64" ]; then
3537
CW_AGENT_BINARY_URI=https://s3.amazonaws.com/amazoncloudwatch-agent/ubuntu/amd64/latest/amazon-cloudwatch-agent.deb
36-
AWS_CLI_BINARY_URI=https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip
3738
else
3839
CW_AGENT_BINARY_URI=https://s3.amazonaws.com/amazoncloudwatch-agent/ubuntu/arm64/latest/amazon-cloudwatch-agent.deb
39-
AWS_CLI_BINARY_URI=https://awscli.amazonaws.com/awscli-exe-linux-aarch64.zip
4040
fi
4141

4242
cd /opt || exit 1
4343

44-
ARCH=$(uname -m)
45-
4644
echo "Intalling AWS CLI"
47-
curl "$AWS_CLI_BINARY_URI" -o "awscliv2.zip"
48-
unzip awscliv2.zip
49-
/opt/aws/install
45+
snap install aws-cli --classic
5046

5147
echo "Downloading assets zip file"
5248
aws s3 cp $ASSETS_S3_PATH ./assets.zip --region $AWS_REGION

0 commit comments

Comments
 (0)