get Instance
Use this data source to get the ID of an Amazon EC2 Instance for use in other resources.
Example Usage
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.ec2.Ec2Functions;
import com.pulumi.aws.ec2.inputs.GetInstanceArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
final var foo = Ec2Functions.getInstance(GetInstanceArgs.builder()
.filters(
GetInstanceFilterArgs.builder()
.name("image-id")
.values("ami-xxxxxxxx")
.build(),
GetInstanceFilterArgs.builder()
.name("tag:Name")
.values("instance-name-tag")
.build())
.instanceId("i-instanceid")
.build());
}
}
Return
A collection of values returned by getInstance.
Parameters
A collection of arguments for invoking getInstance.
Return
A collection of values returned by getInstance.
Parameters
One or more name/value pairs to use as filters. There are several valid keys, for a full reference, check out 1.
If true, wait for password data to become available and retrieve it. Useful for getting the administrator password for instances running Microsoft Windows. The password data is exported to the password_data
attribute. See GetPasswordData for more information.
Retrieve Base64 encoded User Data contents into the user_data_base64
attribute. A SHA-1 hash of the User Data contents will always be present in the user_data
attribute. Defaults to false
.
NOTE: At least one of
filter
,instance_tags
, orinstance_id
must be specified. NOTE: If anything other than a single match is returned by the search, this call will fail. Ensure that your search is specific enough to return a single Instance ID only.
Specify the exact Instance ID with which to populate the data source.
Map of tags, each pair of which must exactly match a pair on the desired Instance.
Map of tags assigned to the Instance.
See also
Return
A collection of values returned by getInstance.
Parameters
Builder for com.pulumi.aws.ec2.kotlin.inputs.GetInstancePlainArgs.