Orchestrator Function: AWS EC2 Instance Tag

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 Tag an AWS EC2 Instance

Public Function: EC2InstanceTag

publicEC2InstanceTag(objAWSClient:AWSClient,arrResourceId:string[],strTagKey:string,strTagValue:string):any{

letobjEC2Tag:EC2Tag=newEC2Tag();
objEC2Tag.setKey(strTagKey);
objEC2Tag.setValue(strTagValue);

letarrEC2Tag:EC2Tag[]= [];
arrEC2Tag.push(objEC2Tag)

letobjEC2CreateTagsRequest:EC2CreateTagsRequest=newEC2CreateTagsRequest();
objEC2CreateTagsRequest=objEC2CreateTagsRequest.withResources(arrResourceId);
objEC2CreateTagsRequest=objEC2CreateTagsRequest.withTags(arrEC2Tag);

letobjAmazonEC2Client:AmazonEC2Client=objAWSClient.getAmazonEC2Client();

letobjEC2CreateTagsResult:EC2CreateTagsResult=objAmazonEC2Client.createTags(objEC2CreateTagsRequest);

returnobjEC2CreateTagsResult;
}

Discover more from Cloud Build Tools

Subscribe to get the latest posts sent to your email.

You may also like