Package org.jclouds.aws.ec2.compute
Class AWSEC2TemplateOptions
- java.lang.Object
-
- org.jclouds.compute.options.RunScriptOptions
-
- org.jclouds.compute.options.TemplateOptions
-
- org.jclouds.ec2.compute.options.EC2TemplateOptions
-
- org.jclouds.aws.ec2.compute.AWSEC2TemplateOptions
-
- All Implemented Interfaces:
Cloneable
public class AWSEC2TemplateOptions extends EC2TemplateOptions implements Cloneable
Contains options supported in theComputeService#runNode
operation on the "ec2" provider.Usage
The recommended way to instantiate a AWSEC2TemplateOptions object is to statically import AWSEC2TemplateOptions.* and invoke a static creation method followed by an instance mutator (if needed):import static org.jclouds.aws.ec2.compute.options.AWSEC2TemplateOptions.Builder.*; ComputeService client = // get connection templateBuilder.options(inboundPorts(22, 80, 8080, 443)); Set extends NodeMetadata> set = client.createNodesInGroup(tag, 2, templateBuilder.build());
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
AWSEC2TemplateOptions.Builder
-
Nested classes/interfaces inherited from class org.jclouds.compute.options.TemplateOptions
TemplateOptions.ImmutableTemplateOptions
-
Nested classes/interfaces inherited from class org.jclouds.compute.options.RunScriptOptions
RunScriptOptions.ImmutableRunScriptOptions
-
-
Field Summary
Fields Modifier and Type Field Description static AWSEC2TemplateOptions
NONE
-
Fields inherited from class org.jclouds.compute.options.TemplateOptions
blockUntilRunning, inboundPorts, networks, nodeNames, privateKey, publicKey, script, securityGroups, tags, userMetadata
-
Fields inherited from class org.jclouds.compute.options.RunScriptOptions
authenticateSudo, blockOnComplete, loginPassword, loginPrivateKey, loginUser, port, runAsRoot, seconds, taskName, wrapInInitScript
-
-
Constructor Summary
Constructors Constructor Description AWSEC2TemplateOptions()
-
Method Summary
-
Methods inherited from class org.jclouds.ec2.compute.options.EC2TemplateOptions
blockOnComplete, clientToken, getBlockDeviceMappings, getClientToken, getGroups, getKeyPair, getMaxCount, getUserData, mapEBSSnapshotToDeviceName, mapNewVolumeToDeviceName, maxCount, runScript, shouldAutomaticallyCreateKeyPair, tags, wrapInInitScript
-
Methods inherited from class org.jclouds.compute.options.TemplateOptions
as, getInboundPorts, getNetworks, getNodeNames, getPrivateKey, getPublicKey, getRunScript, getTags, getUserMetadata, networks, shouldBlockUntilRunning
-
Methods inherited from class org.jclouds.compute.options.RunScriptOptions
copyTo, getLoginPassword, getLoginPrivateKey, getLoginUser, getPort, getSeconds, getTaskName, hasLoginPassword, hasLoginPasswordOption, hasLoginPrivateKey, hasLoginPrivateKeyOption, overrideLoginPassword, overrideLoginPrivateKey, shouldAuthenticateSudo, shouldBlockOnComplete, shouldRunAsRoot, shouldWrapInInitScript, toString
-
-
-
-
Field Detail
-
NONE
public static final AWSEC2TemplateOptions NONE
-
-
Method Detail
-
clone
public AWSEC2TemplateOptions clone()
- Overrides:
clone
in classEC2TemplateOptions
-
copyTo
public void copyTo(TemplateOptions to)
- Overrides:
copyTo
in classEC2TemplateOptions
-
equals
public boolean equals(Object o)
- Overrides:
equals
in classEC2TemplateOptions
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classEC2TemplateOptions
-
string
public com.google.common.base.MoreObjects.ToStringHelper string()
- Overrides:
string
in classEC2TemplateOptions
-
enableMonitoring
public AWSEC2TemplateOptions enableMonitoring()
Enable Cloudwatch monitoring- See Also:
CloudWatchClient
-
placementGroup
public AWSEC2TemplateOptions placementGroup(String placementGroup)
Specifies the keypair used to run instances with
-
noPlacementGroup
public AWSEC2TemplateOptions noPlacementGroup()
Do not use a keypair on instances
-
subnetId
public AWSEC2TemplateOptions subnetId(String subnetId)
Specifies the subnetId used to run instances in
-
iamInstanceProfileArn
public AWSEC2TemplateOptions iamInstanceProfileArn(String arn)
-
iamInstanceProfileName
public AWSEC2TemplateOptions iamInstanceProfileName(String name)
-
privateIpAddress
public AWSEC2TemplateOptions privateIpAddress(String address)
-
tenancy
public AWSEC2TemplateOptions tenancy(Tenancy tenancy)
Specifies the tenancy used to run instances with
-
dedicatedHostId
public AWSEC2TemplateOptions dedicatedHostId(String hostId)
Specifies the ID of the dedicated host on which the instance should resist.
-
spotPrice
public AWSEC2TemplateOptions spotPrice(Float spotPrice)
Specifies the maximum spot price to use
-
spotOptions
public AWSEC2TemplateOptions spotOptions(RequestSpotInstancesOptions spotOptions)
Options for starting spot instances
-
securityGroupIds
public AWSEC2TemplateOptions securityGroupIds(String... groupIds)
- See Also:
AWSEC2TemplateOptions#securityGroupIds(Iterable
)
-
securityGroupIds
public AWSEC2TemplateOptions securityGroupIds(Iterable<String> groupIds)
Specifies the security group ids to be used for nodes with this template
-
blockDeviceMappings
public AWSEC2TemplateOptions blockDeviceMappings(Iterable<? extends BlockDeviceMapping> blockDeviceMappings)
- Overrides:
blockDeviceMappings
in classEC2TemplateOptions
-
userMetadata
public AWSEC2TemplateOptions userMetadata(Map<String,String> userMetadata)
- Overrides:
userMetadata
in classEC2TemplateOptions
- Parameters:
userMetadata
- user-defined metadata to assign to this server
-
userMetadata
public AWSEC2TemplateOptions userMetadata(String key, String value)
- Overrides:
userMetadata
in classEC2TemplateOptions
- Parameters:
key
- key to place into the metadata mapvalue
- value to associate with that key
-
nodeNames
public AWSEC2TemplateOptions nodeNames(Iterable<String> nodeNames)
specifies names to be used for the created nodes. Note that this does not guarantee uniqueness - if there are already existing nodes with a name specified here, there will still be a new node created with the same name. Also, if more nodes are to be created than there are names, subsequent names will use the default naming strategy for that cloud.- Overrides:
nodeNames
in classEC2TemplateOptions
-
networks
public AWSEC2TemplateOptions networks(Iterable<String> networks)
Assigns the created nodes to these networks- Overrides:
networks
in classEC2TemplateOptions
-
keyPair
public AWSEC2TemplateOptions keyPair(String keyPair)
Specifies the keypair used to run instances with- Overrides:
keyPair
in classEC2TemplateOptions
-
mapEBSSnapshotToDeviceName
public AWSEC2TemplateOptions mapEBSSnapshotToDeviceName(String deviceName, String snapshotId, Integer sizeInGib, boolean deleteOnTermination)
- Overrides:
mapEBSSnapshotToDeviceName
in classEC2TemplateOptions
-
mapEphemeralDeviceToDeviceName
public AWSEC2TemplateOptions mapEphemeralDeviceToDeviceName(String deviceName, String virtualName)
- Overrides:
mapEphemeralDeviceToDeviceName
in classEC2TemplateOptions
-
mapNewVolumeToDeviceName
public AWSEC2TemplateOptions mapNewVolumeToDeviceName(String deviceName, int sizeInGib, boolean deleteOnTermination)
- Overrides:
mapNewVolumeToDeviceName
in classEC2TemplateOptions
-
noKeyPair
public AWSEC2TemplateOptions noKeyPair()
Do not use a keypair on instances- Overrides:
noKeyPair
in classEC2TemplateOptions
-
securityGroups
public AWSEC2TemplateOptions securityGroups(Iterable<String> groupIds)
Specifies the security groups to be used for nodes with this template- Overrides:
securityGroups
in classEC2TemplateOptions
-
securityGroups
public AWSEC2TemplateOptions securityGroups(String... groupIds)
- Overrides:
securityGroups
in classEC2TemplateOptions
- See Also:
EC2TemplateOptions#securityGroups(Iterable
)
-
unmapDeviceNamed
public AWSEC2TemplateOptions unmapDeviceNamed(String deviceName)
- Overrides:
unmapDeviceNamed
in classEC2TemplateOptions
-
userData
public AWSEC2TemplateOptions userData(byte[] unencodedData)
Unencoded data- Overrides:
userData
in classEC2TemplateOptions
-
blockOnPort
public AWSEC2TemplateOptions blockOnPort(int port, int seconds)
When the node is started, wait until the following port is active- Overrides:
blockOnPort
in classEC2TemplateOptions
-
inboundPorts
public AWSEC2TemplateOptions inboundPorts(int... ports)
Opens the set of ports to public access.- Overrides:
inboundPorts
in classEC2TemplateOptions
-
authorizePublicKey
public AWSEC2TemplateOptions authorizePublicKey(String publicKey)
authorize an rsa ssh key.- Overrides:
authorizePublicKey
in classEC2TemplateOptions
-
installPrivateKey
public AWSEC2TemplateOptions installPrivateKey(String privateKey)
replaces the rsa ssh key used at login.- Overrides:
installPrivateKey
in classEC2TemplateOptions
-
blockUntilRunning
public AWSEC2TemplateOptions blockUntilRunning(boolean blockUntilRunning)
Note
As of version 1.1.0, this option is incompatible withTemplateOptions.runScript(Statement)
andRunScriptOptions.blockOnComplete(boolean)
, as all current implementations utilize ssh in order to execute scripts.- Overrides:
blockUntilRunning
in classEC2TemplateOptions
- Parameters:
blockUntilRunning
- (default true) whether to block until the nodes in this template are inStatus#RUNNING
state
-
dontAuthorizePublicKey
public AWSEC2TemplateOptions dontAuthorizePublicKey()
- Overrides:
dontAuthorizePublicKey
in classEC2TemplateOptions
-
nameTask
public AWSEC2TemplateOptions nameTask(String name)
- Overrides:
nameTask
in classEC2TemplateOptions
- Returns:
- What to call the task relating to this script; default
jclouds-script-timestamp
where timestamp is millis since epoch
-
runAsRoot
public AWSEC2TemplateOptions runAsRoot(boolean runAsRoot)
- Overrides:
runAsRoot
in classEC2TemplateOptions
-
runScript
public AWSEC2TemplateOptions runScript(Statement script)
This script will be executed as the root user upon system startup. This script gets a prologue, so no #!/bin/bash required, path set up, etc- Overrides:
runScript
in classEC2TemplateOptions
-
overrideLoginCredentials
public AWSEC2TemplateOptions overrideLoginCredentials(LoginCredentials overridingCredentials)
- Overrides:
overrideLoginCredentials
in classEC2TemplateOptions
-
overrideLoginPassword
public AWSEC2TemplateOptions overrideLoginPassword(String password)
- Overrides:
overrideLoginPassword
in classEC2TemplateOptions
-
overrideLoginPrivateKey
public AWSEC2TemplateOptions overrideLoginPrivateKey(String privateKey)
- Overrides:
overrideLoginPrivateKey
in classEC2TemplateOptions
-
overrideLoginUser
public AWSEC2TemplateOptions overrideLoginUser(String loginUser)
- Overrides:
overrideLoginUser
in classEC2TemplateOptions
-
overrideAuthenticateSudo
public AWSEC2TemplateOptions overrideAuthenticateSudo(boolean authenticateSudo)
- Overrides:
overrideAuthenticateSudo
in classEC2TemplateOptions
-
getPlacementGroup
public String getPlacementGroup()
- Returns:
- placementGroup to use when running the instance or null, to generate a placementGroup.
-
shouldAutomaticallyCreatePlacementGroup
public boolean shouldAutomaticallyCreatePlacementGroup()
- Returns:
- true (default) if we are supposed to use a placementGroup
-
isMonitoringEnabled
public boolean isMonitoringEnabled()
- Returns:
- true (default) if we are supposed to enable cloudwatch
-
getSubnetId
public String getSubnetId()
- Returns:
- subnetId to use when running the instance or null.
-
getSpotPrice
public Float getSpotPrice()
- Returns:
- maximum spot price or null.
-
getSpotOptions
public RequestSpotInstancesOptions getSpotOptions()
- Returns:
- options for controlling spot instance requests.
-
getIAMInstanceProfileArn
public String getIAMInstanceProfileArn()
The Amazon resource name (ARN) of the IAM Instance Profile (IIP) to associate with the instance.
-
getIAMInstanceProfileName
public String getIAMInstanceProfileName()
The name of the IAM Instance Profile (IIP) to associate with the instance.
-
getPrivateIpAddress
public String getPrivateIpAddress()
-
getTenancy
public Tenancy getTenancy()
-
getDedicatedHostId
public String getDedicatedHostId()
-
-