Attaching storage
Ideally, you will have defined all your storage requirements up-front as code using a service such as CloudFormation. However, sometimes that is not possible due to application restrictions or changing requirements.
You can easily add additional storage to your instances while they are running by attaching a new volume.
Getting ready
For this recipe, you will need the following:
- A running instance's ID. It will start with
i-
followed by alphanumeric characters. - The AZ the instance is running in. This looks like the region name with a letter after it; for example,
us-east-1a
.
In this recipe, we are using an AWS Linux instance. If you are using a different operating system, the steps to mount the volume will be different. We will be running an instance in the AZ us-east-1a
.
You must have configured your AWS CLI tool with working credentials.
How to do it...
- Create a volume:
aws ec2 create-volume --availability-zone us-east-1a
Note
Take note of the returned VolumeId
in the response...