Function: AWS EC2 Volume Modify

by Simon Sparks · 7 February 2026

To use this function add it to the class library file named OrchestratorPluginAWSService.ts

GitHub Repository: https://github.com/SimonSparksUK/Orchestrator

Filename: OrchestratorPluginAWSService.ts

Description: Orchestrator Function to Modify an AWS EC2 Volume

Public Function: EC2VolumeModify

public EC2VolumeModify(objAWSClient: AWSClient, strVolumeId: string, intIops: number, intSize: number, intThroughput: number, strVolumeType: "standard" | "io1" | "io2" | "gp2" | "sc1" | "st1" | "gp3" = "gp2", blnMultiAttachEnabled: boolean = false): EC2VolumeModification {

    // IOPS
    // gp3: 3,000(default ) - 80,000 IOPS
    // io1: 100 - 64,000 IOPS
    // io2: 100 - 256,000 IOPS

    // SIZE
    // gp2: 1 - 16, 384 GiB
    // gp3: 1 - 65, 536 GiB
    // io1: 4 - 16, 384 GiB
    // io2: 4 - 65, 536 GiB
    // st1 and sc1: 125 - 16, 384 GiB
    // standard: 1 - 1024 GiB

    // THROUGHPUT - Valid Range: 125 - 2000 MiB/s

    // VOLUME TYPE
    // General Purpose SSD: gp2 | gp3
    // Provisioned IOPS SSD: io1 | io2
    // Throughput Optimized HDD: st1 - can't be used as boot volume
    // Cold HDD: sc1 - can't be used as boot volume
    // Magnetic: standard

    let objAmazonEC2Client: AmazonEC2Client = objAWSClient.getAmazonEC2Client();

    let objEC2ModifyVolumeRequest: EC2ModifyVolumeRequest = new EC2ModifyVolumeRequest();
    objEC2ModifyVolumeRequest.setVolumeId(strVolumeId);
    objEC2ModifyVolumeRequest.setIops(intIops);
    objEC2ModifyVolumeRequest.setMultiAttachEnabled(blnMultiAttachEnabled)
    objEC2ModifyVolumeRequest.setSize(intSize);
    objEC2ModifyVolumeRequest.setThroughput(intThroughput);
    objEC2ModifyVolumeRequest.setVolumeType(strVolumeType);

    let objEC2ModifyVolumeResult: EC2ModifyVolumeResult = objAmazonEC2Client.modifyVolume(objEC2ModifyVolumeRequest);

    let objEC2VolumeModification:EC2VolumeModification = objEC2ModifyVolumeResult.getVolumeModification();

    return objEC2VolumeModification;
}

Discover more from Cloud Build Tools

Subscribe to get the latest posts sent to your email.

You may also like