AwsEc2Template

public class AwsEc2Template implements Comparable<AwsEc2Template>

Represents an Amazon EC2 Instance template. This class enables reading a template from a JSON file, containing actual configurations for VMs available in Amazon Web Services.

For more details, check Raysa Oliveira’s Master Thesis (only in Portuguese).

Author:raysaoliveira

See also: .getInstance(String)

Fields

NULL

public static final AwsEc2Template NULL

Constructors

AwsEc2Template

public AwsEc2Template()

Default constructor used to create an AwsEc2Template instance. If you want to get a template from a JSON file, you shouldn’t call the constructor directly. Instead, use some methods such as the getInstance(String).

This constructor is just provided to enable the Gson object to use reflection to instantiate a AwsEc2Template.

See also: .getInstance(String)

AwsEc2Template

public AwsEc2Template(AwsEc2Template source)

A clone constructor which receives an AwsEc2Template and creates a clone of it.

Parameters:

AwsEc2Template

public AwsEc2Template(String jsonFilePath)

Instantiates an AWS EC2 Instance from a JSON file.

Parameters:
  • jsonFilePath – the full path to the JSON file representing the template with configurations for an AWS EC2 Instance

See also: .getInstance(String)

Methods

compareTo

public int compareTo(AwsEc2Template template)

getCpus

public int getCpus()

getFileName

public String getFileName()

Gets only the name of the JSON template file used to create this template, without the path.

getFilePath

public String getFilePath()

Gets the full path to the JSON template file used to create this template.

getInstance

public static AwsEc2Template getInstance(String jsonFilePath)

Gets an AWS EC2 Instance from a JSON file inside the application’s resource directory. Use the available constructors if you want to load a file outside the resource directory.

Parameters:
  • jsonFilePath – the relative path to the JSON file representing the template with configurations for an AWS EC2 Instance
Returns:

the AWS EC2 Instance from the JSON file

getMemoryInMB

public int getMemoryInMB()

getName

public String getName()

getPricePerHour

public double getPricePerHour()

Gets the price per hour of a VM created from this template

setCpus

public void setCpus(int cpus)

setMemoryInMB

public void setMemoryInMB(int memoryInMB)

setName

public void setName(String name)

setPricePerHour

public void setPricePerHour(double pricePerHour)

toString

public String toString()