How you can Improve the disk measurement on a Cloud9 occasion
If you might want to enhance the disk measurement of a Cloud9 occasion, you possibly can run the next script instantly from the terminal in Cloud9:
pip3 set up --user --upgrade boto3
export instance_id=$(curl -s http://169.254.169.254/newest/meta-data/instance-id)
python3 -c "import boto3
import os
from botocore.exceptions import ClientError
ec2 = boto3.shopper('ec2')
volume_info = ec2.describe_volumes(
Filters=[
{
'Name': 'attachment.instance-id',
'Values': [
os.getenv('instance_id')
]
}
]
)
volume_id = volume_info['Volumes'][0]['VolumeId']
attempt:
resize = ec2.modify_volume(
VolumeId=volume_id,
Dimension=30
)
print(resize)
besides ClientError as e:
if e.response['Error']['Code'] == 'InvalidParameterValue':
print('ERROR MESSAGE: {}'.format(e))"
if [ $? -eq 0 ]; then
sudo reboot
fi