private Instance tagInstance(Instance instance, String scalingGroup)
throws ScalingGroupException {
// assign a name to the instance via the Name tag
String instanceName = String.format("%s-%s", scalingGroup,
instance.getInstanceId());
Tag nameTag = new Tag().withKey(Constants.NAME_TAG).withValue(
instanceName);
// tag new instance with scaling group
Tag scalingGroupTag = new Tag().withKey(Constants.SCALING_GROUP_TAG)
.withValue(getScalingGroupName());
try {
this.client.tagInstance(instance.getInstanceId(),
Arrays.asList(nameTag, scalingGroupTag));