Orchestrator Function: AWS EC2 Volume Attach

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 Attach an AWS EC2 Volume to an EC2 Instance

Public Function: EC2VolumeAttach

publicEC2VolumeAttach(objAWSClient:AWSClient,strVolumeId:string,strDevice:string,strInstanceId:string):EC2VolumeAttachment{

letobjAmazonEC2Client:AmazonEC2Client=objAWSClient.getAmazonEC2Client();

letobjEC2AttachVolumeRequest:EC2AttachVolumeRequest=newEC2AttachVolumeRequest();
objEC2AttachVolumeRequest.setVolumeId(strVolumeId);
objEC2AttachVolumeRequest.setInstanceId(strInstanceId);
objEC2AttachVolumeRequest.setDevice(strDevice);

letobjEC2AttachVolumeResult:EC2AttachVolumeResult=objAmazonEC2Client.attachVolume(objEC2AttachVolumeRequest);

letobjEC2VolumeAttachment:EC2VolumeAttachment=objEC2AttachVolumeResult.getAttachment();

returnobjEC2VolumeAttachment;
}

Discover more from Cloud Build Tools

Subscribe to get the latest posts sent to your email.

You may also like