Run anything on aws. No really, anything! If the aws api supports it, the pypyr aws plug-in supports it.
It's a pretty easy way of invoking the aws api as a step in a series of steps without having to write code.
pypyr is a cli & api to run pipelines defined in yaml.
All documentation for the pypyr aws plugin is here: https://pypyr.io/docs/plugins/aws/
Why use this when you could just use the aws-cli instead? The aws cli is all kinds of awesome, but I find more often than not it's not just one or two aws ad hoc cli or aws api methods you have to execute, but especially when automating and scripting you actually need to run a sequence of commands, where the output of a previous command influences what you pass to the next command.
Sure, you can bash it up, and I do that too, but running it as a pipeline via pypyr has actually made my life quite a bit easier because of not having to deal with conditionals, error traps and input validation.
$ pip install --upgrade pypyraws
pypyraws
depends on the pypyr core. The above pip
will install it
for you if you don't have it already.
Here is some sample yaml of what a pipeline using the pypyr-aws plug-in to upload a file to s3 would look like:
context_parser: pypyr.parser.keyvaluepairs
steps:
- name: pypyraws.steps.client
description: upload a file to s3
in:
awsClientIn:
serviceName: s3
methodName: upload_file
methodArgs:
Filename: ./testfiles/arb.txt
Bucket: '{bucket}'
Key: arb.txt
If you saved this yaml as ./pipelines/go-go-s3.yaml
, you can run it like this
to upload arb.txt
to your specified bucket:
$ pypyr go-go-s3 bucket=myuniquebucketname
But wait, there's more! You can make a custom waiter for any aws client operation and wait for a specified field in the response to become the value you want it to be.
This is especially handy for things like Beanstalk, because Elastic Beanstalk does not have Waiters for environment creation.
The input context looks like this:
awsWaitFor:
awsClientIn: # required. awsClientIn allows the same arguments as pypyraws.steps.client.
serviceName: elasticbeanstalk
methodName: describe_environments
methodArgs:
ApplicationName: my wonderful beanstalk default application
EnvironmentNames:
- my-wonderful-environment
VersionLabel: v0.1
waitForField: '{Environments[0][Status]}' # required. format expression for field name to check in awsClient response
toBe: Ready # required. Stop waiting when waitForField equals this value
pollInterval: 30 # optional. Seconds to wait between polling attempts. Defaults to 30 if not specified.
maxAttempts: 10 # optional. Defaults to 10 if not specified.
errorOnWaitTimeout: True # optional. Defaults to True if not specified. Stop processing if maxAttempts exhausted without reaching toBe value.
Don't Panic! Check the pypyraws technical docs to begin. For help, community & talk, check pypyr twitter, or join the chat at the pypyr community discussion forum!
For information on how to help with pypyr, run tests and coverage, please do check out the pypyr contribution guide.
Well, you know. No one's perfect. Feel free to create an issue.
pypyr is free & open-source software distributed under the Apache 2.0 License.
Please see LICENSE in the root of the repo.
Copyright 2017 the pypyr contributors.