BAEL-1572: Use instance ID of newly created instance for the rest of the examples
This commit is contained in:
parent
92bf897874
commit
f4a7946634
|
@ -39,8 +39,6 @@ public class EC2Application {
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
|
|
||||||
String yourInstanceId = "<you-instance>";
|
|
||||||
|
|
||||||
// 0) - Set up the client
|
// 0) - Set up the client
|
||||||
AmazonEC2 ec2Client = AmazonEC2ClientBuilder.standard()
|
AmazonEC2 ec2Client = AmazonEC2ClientBuilder.standard()
|
||||||
.withCredentials(new AWSStaticCredentialsProvider(credentials))
|
.withCredentials(new AWSStaticCredentialsProvider(credentials))
|
||||||
|
@ -91,7 +89,7 @@ public class EC2Application {
|
||||||
.withKeyName("baeldung-key-pair") // optional - if not present, can't connect to instance
|
.withKeyName("baeldung-key-pair") // optional - if not present, can't connect to instance
|
||||||
.withSecurityGroups("BaeldungSecurityGroup");
|
.withSecurityGroups("BaeldungSecurityGroup");
|
||||||
|
|
||||||
ec2Client.runInstances(runInstancesRequest);
|
String yourInstanceId = ec2Client.runInstances(runInstancesRequest).getReservation().getInstances().get(0).getInstanceId();
|
||||||
|
|
||||||
// 6) Monitor Instances
|
// 6) Monitor Instances
|
||||||
MonitorInstancesRequest monitorInstancesRequest = new MonitorInstancesRequest()
|
MonitorInstancesRequest monitorInstancesRequest = new MonitorInstancesRequest()
|
||||||
|
|
Loading…
Reference in New Issue