Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def lambda_handler(event, context):
- import subprocess
- # Define parameters
- user = 'myUser'
- password = 'myPass'
- host = 'my.endpoint.amazon.aws.com'
- name = 'myDB'
- # Define MySQL dump bash command
- bashCommand = "mysqldump --user=%s --password=%s --host=%s %s > myFile.sql"
- % (user, password, host, name)
- # Define subprocess
- process = subprocess.Popen(bashCommand.split(), stdout=subprocess.PIPE)
- # Execute subprocess
- output = process.communicate()[0]
- # End
- return 'myDb RDS MySQL dump completed!'
- START RequestId: 0e7e0d6b-4a06-11e6-8a09-a39e1a6b858b Version: $LATEST
- [Errno 2] No such file or directory: OSError
- Traceback (most recent call last):
- File "/var/task/lambda_function.py", line 15, in lambda_handler
- process = subprocess.Popen(bashCommand.split(), stdout=subprocess.PIPE)
- File "/usr/lib64/python2.7/subprocess.py", line 710, in __init__
- errread, errwrite)
- File "/usr/lib64/python2.7/subprocess.py", line 1335, in _execute_child
- raise child_exception
- OSError: [Errno 2] No such file or directory
- END RequestId: IDstuff
- REPORT RequestId: blahblahblah Duration: 2.26 ms Billed Duration: 100 ms Memory Size: 128 MB Max Memory Used: 16 MB
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement