Importing the disk file as a snapshot
Follow the steps below to convert the disk file to snapshot, so that you can create an image based on the snapshot. To run the AWS commands in this topic, you must have:
- Installed AWS Command Line Interface (CLI) in your environment. See Installing the AWS CLI.
- Configured the AWS CLI. See Configuring the AWS CLI.
To import the disk file as a snapshot:
-
Create a .json file in your local directory containing the following information. The "Format" should be "raw". The "Url" is the Object URL of the disk file.
{
"Description": "the-description-of-the-snapshot",
"Format": "raw",
"Url": "https://s3.ap-northeast-2.amazonaws.com/fwm/boot.disk"
}
-
Run command to import the disk file as a snapshot.
aws ec2 import-snapshot --description "the-description-of-the-snapshot" --disk-container file://cm.json
The following printout will display:
{
"ImportTaskId": "import-snap-abcd1234",
"SnapshotTaskDetail":[
{
"DiskImageSize": "0.0",
"Progress": "3",
"Status": "active",
"Description": "FWM-disk",
"url": "https://s3.ap-northeast-2.amazonaws.com/fwm/boot.disk"
"StatusMessage": "pending"
}
],
"Description": "FWM-import-task"
}
- Use the
describe-import-snapshot-tasks
command to confirm that your snapshot is imported successfully. The following is an example.$ aws ec2 describe-import-snapshot-tasks --import-task-ids import-snap-abcd1234
Wait until the status in the printout shows completed, which means the import task is completed and the snapshot is ready to use.