-
Notifications
You must be signed in to change notification settings - Fork 402
REST API
All of the "list" and "show" URLs can take a .json or .xml suffix to the end of the URL.
- Instance list:
- Instances of one application:
- Instance details:
- Autoscaling group details:
- Cluster details:
Do an HTTP GET request for the JSON data for the object. Ignore the response body. Check the response HTTP status code. 200 means the object exists. 404 means the object does not exist.
- Example ASG URL: http://asgardprod/us-east-1/autoScaling/show/helloworld-example.json
- Example AMI URL: http://asgardprod/us-east-1/image/show/ami-a8fe0ec1.json
curl -sL -w "%{http_code}" http://asgardprod/us-east-1/autoScaling/show/helloworld-example.json -o /dev/null
http://asgardprod/region/list.json
http://asgardprod/application/list.json
- HTML: http://asgardprod/application/show/helloworld
- JSON: http://asgardprod/application/show/helloworld.json
- HTML: http://asgardprod/us-east-1/instance/list/helloworld
- JSON: http://asgardprod/us-east-1/instance/list/helloworld.json
Note: omit the checkHealth parameter from all examples below if Eureka service is not in use
- HTML: http://asgardprod/us-east-1/cluster/show/helloworld-debug
- JSON: http://asgardprod/us-east-1/cluster/show/helloworld-debug.json
http://asgardprod/us-east-1/cluster/anyInstance/helloworld-example?field=publicDnsName
http://asgardprod/us-east-1/autoScaling/anyInstance/helloworld-example?field=publicDnsName
Replace an instance in an ASG in one specific zone when the service is also running in other zones, programmatically
- Get the list of instances within an auto scaling group in JSON or XML like this:
- Get data from one of those endpoints, choose an instance with the targeted availabilityZone such as us-east-1d, record the targeted instance's instanceId such as i-adf91fc3
- Terminate the instance using a POST request
- Endpoint:
http://asgardprod/us-east-1/instance/terminate
- POST data:
instanceId=i-adf91fc3
- Endpoint:
- Command line example:
curl -d "instanceId=i-adf91fc3" http://asgardprod/us-east-1/instance/terminate
Let's say the ASG is helloworld-example-v000 and the new size you want is 4. curl -d "name=helloworld-example-v000&minAndMaxSize=4" http://asgardprod/us-east-1/cluster/resize
curl -d "name=helloworld-testeng&appName=helloworld&imageId=ami-dc9169b5&instanceType=m2.2xlarge&keyName=nf-test-keypair-a&selectedSecurityGroups=helloworld&selectedSecurityGroups=helloworld-frontend&kernelId=&ramdiskId=&relaunchCount=1&concurrentRelaunches=1&newestFirst=false&checkHealth=on&afterBootWait=30" http://asgardprod/us-east-1/push/startRolling
Change those values based on what you would use in the rolling push graphical user interface http://asgardprod/us-east-1/push/editRolling/helloworld-testeng
curl -d "name=helloworld-example&imageId=ami-40788629&trafficAllowed=true&checkHealth=true" http://asgardprod/us-east-1/cluster/createNextGroup
Create an ASG named helloworld-integrationtest-US-A, in three AZs, with two security groups, with image ami-3178b958, programmatically
curl -d "appName=helloworld&stack=integrationtest&detail=US-A&min=0&desiredCapacity=0&max=0&defaultCooldown=10&healthCheckType=EC2&healthCheckGracePeriod=600&selectedZones=us-east-1a&selectedZones=us-east-1c&selectedZones=us-east-1d&azRebalance=enabled&imageId=ami-3178b958&keyName=nf-test-keypair-a&selectedSecurityGroups=helloworld&selectedSecurityGroups=helloworld-frontend&instanceType=m1.large&iamInstanceProfile=AcmeAnvilsIamInstanceProfile" http://asgardprod/us-east-1/autoScaling/save
There are no intelligent defaults for this operation, so for now you'll need to specify each property that already exists as well as the ones that you want to change, such as the selected zones.
curl -d "name=helloworld-nactest&launchConfiguration=helloworld-nactest-20110716221107&min=1&desiredCapacity=1&max=1&defaultCooldown=10&healthCheckType=EC2&healthCheckGracePeriod=600&selectedZones=us-west-1a&selectedZones=us-west-1c&azRebalance=enabled&launch=enabled&terminate=enabled&addToLoadBalancer=enabled" http://asgardprod/us-west-1/autoScaling/update
curl -d "name=helloworld-example-v004" http://asgardprod/us-east-1/cluster/deactivate
curl -d "name=helloworld-integrationtest" http://asgardprod/us-east-1/cluster/delete
That will do a 302 redirect to a long-running task to terminated instances, wait for auto scaling activities to cease, then delete the ASG and its Launch Configurations.
curl -d "id=ami-ffa6f1ba&ticket=" http://asgardprod/us-east-1/image/delete
curl -d "volumeId=vol-7de39216&ticket=" http://asgardprod/us-east-1/volume/delete
curl -d "snapshotId=snap-65ed8d04&ticket=" http://asgardprod/us-east-1/snapshot/delete
curl -d 'owner=jsmith&pricing=ondemand&imageId=ami-b75d92de&zone=us-east-1d&instanceType=m1.large&selectedGroups=helloworld&selectedGroups=helloworld-frontend' http://asgardprod/us-east-1/image/launch.json
http://asgardprod/us-east-1/security/list.json
http://asgardprod/us-east-1/launchConfiguration/list.json
- (HTML) http://asgardprod/us-east-1/instance/find?by=ipAddr&value=10.192.112.211,10.104.123.253,10.117.22.180,10.125.43.6,10.125.50.124,10.127.149.118,10.194.213.187,10.217.7.212
- (XML) http://asgardprod/us-east-1/instance/find.xml?by=ipAddr&value=10.192.112.211,10.104.123.253,10.117.22.180,10.125.43.6,10.125.50.124,10.127.149.118,10.194.213.187,10.217.7.212
- (JSON) http://asgardprod/us-east-1/instance/find.json?by=ipAddr&value=10.192.112.211,10.104.123.253,10.117.22.180,10.125.43.6,10.125.50.124,10.127.149.118,10.194.213.187,10.217.7.212
- (HTML) http://asgardprod/us-east-1/instance/find?by=instanceId&value=i-a1aa23c0,i-cfad24ae,i-ddad24bc
curl -d "name=batgirl&type=Web+Service&description=Captures+bad+guys&owner=Barbara+Gordon&email=bgordon%40wayneenterprises.com&monitorBucketType=application&ticket=" http://asgardprod/application/save
curl -d "name=batgirl&ticket=" http://nactest.netflix.com/application/delete
A Netflix Original Production
Tech Blog | Twitter @NetflixOSS | Jobs