Deploying AWS Storage Gateway on EC2 and Provisioning iSCSI Volumes with the AWS CLI

To deploy AWS Storage Gateway on an EC2 instance and provision iSCSI storage volumes using the AWS CLI, you can follow these steps. Please note that this is a high-level overview, and you’ll need to replace placeholders with your specific information.


  • AWS CLI installed and configured with the necessary IAM permissions.
  • An EC2 instance in the same AWS region where you want to provision iSCSI volumes.

Here’s how you can do it using the AWS CLI:

  1. Launch an EC2 Instance:
    If you haven’t already, launch an EC2 instance that meets the requirements for the Storage Gateway software.
  2. Install and Configure Storage Gateway:
    SSH into your EC2 instance and install the AWS Storage Gateway software. You can download the software using the following command:

Replace <platform> with your platform (e.g., x86_64). Then install the package:

   sudo dpkg -i AWSStorageGateway-latest-<platform>.deb

Run the aws-storage-gateway-config command to configure your gateway. Follow the prompts and provide the necessary information such as your activation key, AWS region, and local disks to expose through the gateway.

  1. Activate the Gateway:
    You need to activate the gateway using the activation key obtained from the AWS Management Console:
   sudo aws-storage-gateway-activation-cli activate-gateway

Follow the prompts and provide the activation key and the region where you want to activate the gateway.

  1. Create iSCSI Volumes:
    You can use the AWS CLI to create iSCSI volumes. For example, to create a volume, you can use the create-storeage-volume command:
   aws storagegateway create-stored-volume --gateway-arn <your-gateway-arn> --disk-id <your-disk-id> --preserve-existing-data

Replace <your-gateway-arn> with the ARN of your gateway and <your-disk-id> with a unique identifier for your disk.

  1. Connect to Volumes:
    On your EC2 instance, you can use the iscsiadm tool (on Linux) to connect to the iSCSI volumes. You’ll need the target IP address and other relevant information:
   iscsiadm -m discovery -t st -p <target-ip>
   iscsiadm -m node --login
  1. Use the Volumes:
    After connecting, the iSCSI volumes will be accessible on your EC2 instance. You can format them, mount them, and use them as block storage.

These are the essential steps to deploy AWS Storage Gateway and provision iSCSI volumes using the AWS CLI. Make sure to refer to the AWS documentation and adapt the commands to your specific use case and requirements.

When you mount an AWS iSCSI volume to an EC2 instance, the underlying hardware remains in the AWS data center, and the volume is virtually attached to your EC2 instance. Here’s what happens when you mount an AWS iSCSI volume to an EC2 instance:

  1. Volume Configuration: First, you create an AWS iSCSI volume using AWS services like AWS Storage Gateway or Amazon EBS. This volume is configured and stored on AWS hardware in a data center.
  2. iSCSI Target Configuration: The iSCSI volume is associated with an iSCSI target, which defines the access settings and security policies for the volume.
  3. Volume Attachment: You then initiate the volume attachment process from your EC2 instance. This process involves using the iSCSI initiator on the EC2 instance to establish a connection to the AWS iSCSI target.
  4. Volume Access: Once the connection is established, the iSCSI volume becomes accessible from your EC2 instance as if it were a locally attached block storage device. The operating system on the EC2 instance recognizes the volume as a block device, and you can format it with a file system and use it to store data.
  5. Data Transfer: Data read and written to the iSCSI volume by your EC2 instance is transmitted over the Internet via the iSCSI protocol to the AWS data center where the volume is physically stored. This data is securely transmitted over the Internet using encryption.
  6. Storage Location: The actual data is stored on AWS hardware, which may consist of distributed storage infrastructure like Amazon EBS or Amazon S3. The specifics depend on the AWS service you used to create the volume.
  7. Data Redundancy and Durability: AWS provides redundancy, backups, and durability features to ensure that your data is highly available and protected against hardware failures or data loss. The data is often distributed across multiple physical devices for increased redundancy.

It’s important to note that the EC2 instance only sees the iSCSI volume as a block storage device attached to its operating system. The underlying hardware, data storage, and management are abstracted and handled by AWS. The EC2 instance interacts with the iSCSI volume over the network, allowing you to access and manage the data while AWS manages the hardware infrastructure.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top