Scaling the web server

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:

  1. 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)
  1. 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
  1. Once stopped, modify the attribute via the CLI, as follows:
aws ec2 modify-instance-attribute --instance-id $CURRENT_INSTANCE --instance-type m4.large
  1. Restart the instance, as follows:
aws ec2 start-instances --instance-id $CURRENT_INSTANCE --output json

Well done! Now, your web server is running on hardware with a larger capacity.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.22.74.66