public interface EC2Service
This service provides a layer of abstraction around the EC2 API calls provided by Amazon that are useful for common tasks.
For example, launchInstance() starts a single EC2 instance and waits until Amazon has confirmed that the instance is online and functioning.
Modifier and Type | Method and Description |
---|---|
void |
allowTermination(String instanceId)
Set a flag that allows an Amazon EC2 instance to be terminated.
|
String |
copyAmi(String region,
String ami) |
String |
copyAmi(String region,
String ami,
String name) |
com.amazonaws.services.ec2.model.Image |
createAmi(CreateAMIRequest request) |
void |
createSecurityGroup(KualiSecurityGroup group)
Create a new security group (it must not exist yet)
|
com.amazonaws.services.ec2.model.Snapshot |
createSnapshot(String volumeId,
String description,
int timeoutMillis)
Snapshot a volume.
|
void |
deleteSnapshot(String snapshotId) |
String |
getAccessKey() |
com.amazonaws.services.ec2.model.Image |
getImage(String imageId)
Return an Image object given an image id
|
List<com.amazonaws.services.ec2.model.Image> |
getImages() |
com.amazonaws.services.ec2.model.Instance |
getInstance(String instanceId)
Return an Amazon EC2 instance object given an instance id.
|
List<com.amazonaws.services.ec2.model.Instance> |
getInstances() |
List<com.amazonaws.services.ec2.model.Instance> |
getInstances(List<String> instanceIds) |
List<com.amazonaws.services.ec2.model.Image> |
getMyImages()
Return a list of all the AMI's you own.
|
String |
getRegion() |
com.google.common.base.Optional<com.amazonaws.services.ec2.model.SecurityGroup> |
getSecurityGroup(String name)
Return the security group object associated with
name |
List<String> |
getSecurityGroupNames()
Return a list containing the names of all the security groups.
|
com.amazonaws.services.ec2.model.Snapshot |
getSnapshot(String snapshotId)
Return a snapshot object, given a snapshot id
|
String |
getStatus(String instanceId,
InstanceStatusType type,
String statusName)
Each Amazon EC2 instance has a list of statuses associated with it.
|
String |
importKey(String keyName,
String publicKey)
Import the public key using the given name into Amazon.
|
boolean |
isExistingKey(String keyName)
Return true if Amazon has a public key stored under this name.
|
boolean |
isExistingSecurityGroup(String name)
Return true if there is already a security group with the given name.
|
boolean |
isOnline(String instanceId)
This method returns true if the Amazon EC2 instance meets three conditions:
|
com.amazonaws.services.ec2.model.Instance |
launchInstance(LaunchInstanceContext context)
Launch a single Amazon EC2 instance and wait until Amazon confirms that the instance is online and functioning.
|
void |
preventTermination(String instanceId)
Set a flag that prevent's an Amazon EC2 instance from being terminated.
|
void |
purgeAmi(String imageId)
Deregister the AMI and delete any snapshots associated with it.
|
SetPermissionsResult |
setPermissions(String securityGroupName,
List<Permission> permissions)
Make the permissions for the indicated security group match the list provided.
|
com.amazonaws.services.ec2.model.Instance |
startInstance(String instanceId) |
void |
stopInstance(String instanceId) |
void |
tag(String resourceId,
List<com.amazonaws.services.ec2.model.Tag> tags)
Create tags on the indicated Amazon EC2 resource (instance, volume, snapshot, ami, etc).
|
void |
tag(String resourceId,
com.amazonaws.services.ec2.model.Tag tag)
Create tags on the indicated Amazon EC2 resource (instance, volume, snapshot, ami, etc).
|
void |
terminateInstance(String instanceId)
Terminate a single Amazon EC2 instance and wait until Amazon confirms that the instance has been terminated.
|
String getAccessKey()
com.amazonaws.services.ec2.model.Instance startInstance(String instanceId)
void stopInstance(String instanceId)
void deleteSnapshot(String snapshotId)
void purgeAmi(String imageId)
com.amazonaws.services.ec2.model.Image createAmi(CreateAMIRequest request)
com.amazonaws.services.ec2.model.Snapshot createSnapshot(String volumeId, String description, int timeoutMillis)
com.amazonaws.services.ec2.model.Snapshot getSnapshot(String snapshotId)
List<com.amazonaws.services.ec2.model.Image> getMyImages()
com.amazonaws.services.ec2.model.Image getImage(String imageId)
com.amazonaws.services.ec2.model.Instance launchInstance(LaunchInstanceContext context)
terminateInstance
void terminateInstance(String instanceId)
launchInstance
boolean isOnline(String instanceId)
This method returns true if the Amazon EC2 instance meets three conditions:
running
state.If this method returns false, the instance cannot be used in any meaningful way.
void preventTermination(String instanceId)
allowTermination
void allowTermination(String instanceId)
preventTermination
com.amazonaws.services.ec2.model.Instance getInstance(String instanceId)
List<com.amazonaws.services.ec2.model.Instance> getInstances(List<String> instanceIds)
List<com.amazonaws.services.ec2.model.Instance> getInstances()
void tag(String resourceId, List<com.amazonaws.services.ec2.model.Tag> tags)
void tag(String resourceId, com.amazonaws.services.ec2.model.Tag tag)
List<String> getSecurityGroupNames()
com.google.common.base.Optional<com.amazonaws.services.ec2.model.SecurityGroup> getSecurityGroup(String name)
name
boolean isExistingSecurityGroup(String name)
SetPermissionsResult setPermissions(String securityGroupName, List<Permission> permissions)
Make the permissions for the indicated security group match the list provided.
void createSecurityGroup(KualiSecurityGroup group)
String importKey(String keyName, String publicKey)
boolean isExistingKey(String keyName)
String getStatus(String instanceId, InstanceStatusType type, String statusName)
Each Amazon EC2 instance has a list of statuses associated with it.
Each status has a name and value and is associated with either the ability of Amazon's internal systems to determine that status (external to the instance itself) or with the status of something going on internally to the instance.
A SYSTEM status is analogous to saying "is powered on", or "is connected to the network", but says nothing about the state of any software running on the instance.
An INSTANCE status indicates something about the state of software running on the instance, aka "is operating system running"
Copyright © 2004–2014 The Kuali Foundation. All rights reserved.