Enabling Amazon CloudWatch on a New Amazon EC2 Instance
This section describes how to enable monitoring when running a new instance.
Procedure
To launch an instance
-
If you are using SOAP, construct the following request:
<RunInstances xmlns="http://ec2.amazonaws.com/doc/2009-07-15/"> <imageId>
ami-id
</imageId> <minCount>1</minCount> <maxCount>1</maxCount> <keyName>keypair-name
</keyName> <groupSet/> <monitoring>enabled</monitoring> </RunInstances> -
If you are using Query, construct the following request:
https://ec2.amazonaws.com/ ?Action=RunInstances &ImageId=
ami-id
&MaxCount=1 &MinCount=1 &KeyName=keypair-name
&Monitoring.Enabled &...auth parameters... -
View output similar to the following:
<RunInstancesResponse xmlns="http://ec2.amazonaws.com/doc/2009-07-15/"> <reservationId>r-47a5402e</reservationId> <ownerId>AIDADH4IGTRXXKCD</ownerId> <groupSet> <item> <groupId>default</groupId> </item> </groupSet> <instancesSet> <item> <instanceId>i-2ba64342</instanceId> <imageId>ami-60a54009</imageId> <instanceState> <code>0</code> <name>pending</name> </instanceState> <privateDnsName></privateDnsName> <dnsName></dnsName> <keyName>example-key-name</keyName> <amiLaunchIndex>0</amiLaunchIndex> <instanceType>m1.small</instanceType> <launchTime>2007-08-07T11:51:50.000Z</launchTime> <placement> <availabilityZone>us-east-1b</availabilityZone> </placement> <monitoring> <enabled>true</enabled> </monitoring> </item> </instancesSet> </RunInstancesResponse>