Last active
April 27, 2017 13:01
-
-
Save omerxx/7e522801e824b2ca189be9a5cdbe59bb to your computer and use it in GitHub Desktop.
Lambda function for killing random task on an ecs family
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def lambda_handler(event, context): | |
| import boto3 | |
| client = boto3.client('ecs', aws_access_key_id='', aws_secret_access_key='') | |
| response = client.list_tasks(cluster='mycluster', family='myservice', maxResults=1,desiredStatus='RUNNING') | |
| stoptask = response['taskArns'][0].split('/')[1] | |
| print client.stop_task(cluster='mycluster', task=stoptask, reason='chaos monkey') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment