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
public EC2InstanceTag(objAWSClient: AWSClient, arrResourceId: string[], strTagKey: string, strTagValue: string): any {
let objEC2Tag: EC2Tag = new EC2Tag();
objEC2Tag.setKey(strTagKey);
objEC2Tag.setValue(strTagValue);
let arrEC2Tag: EC2Tag[] = [];
arrEC2Tag.push(objEC2Tag)
let objEC2CreateTagsRequest: EC2CreateTagsRequest = new EC2CreateTagsRequest();
objEC2CreateTagsRequest = objEC2CreateTagsRequest.withResources(arrResourceId);
objEC2CreateTagsRequest = objEC2CreateTagsRequest.withTags(arrEC2Tag);
let objAmazonEC2Client: AmazonEC2Client = objAWSClient.getAmazonEC2Client();
let objEC2CreateTagsResult: EC2CreateTagsResult = objAmazonEC2Client.createTags(objEC2CreateTagsRequest);
return objEC2CreateTagsResult;
}Discover more from Cloud Build Tools
Subscribe to get the latest posts sent to your email.
