Once our instance has been provisioned and the web server is running, we will add a greater capacity to permit more concurrent users to interact with the web service. We will do this by going through the following steps:
- Obtain the instance-id with the following expression:
export CURRENT_INSTANCE=$(aws ec2 describe-instances --query 'Reservations[*].Instances[*].InstanceId' --filters 'Name=instance-state-name,Values=running' --output text)
- We must stop the instance to change the instance-type attribute to m4.large, as follows:
aws ec2 stop-instances --instance-id $CURRENT_INSTANCE --output json
- Once stopped, modify the attribute via the CLI, as follows:
aws ec2 modify-instance-attribute --instance-id $CURRENT_INSTANCE --instance-type m4.large
- Restart the instance, as follows:
aws ec2 start-instances --instance-id $CURRENT_INSTANCE...