This Ansible Playbook will deploy a Lambda function in AWS. The Lambda function will then be used to run a dummy Python script to move files in the associated S3 bucket. This code also provides a handy clean-up script.
You will need the following to use this script:
- Ansible
- An AWS Account
Enter the bucket name in python script.
- Open move_s3_files.py
- Replace "Enter-name-of-your-bucket" with proper name of your bucket.
To deploy the s3 bucket and lambda function on AWS.
- Open deploy_lambda.yaml
- Edit the Vars section with proper values.
- To deploy and create lambda execute the below commands.
ansible-playbook deploy.yaml
To destroy the s3 bucket and lambda function on AWS.
- open destroy.yaml
- Edit the Vars section with proper values.
- Now to destroy aws resources execute the below commands.
ansible-playbook destroy.yaml
Feel free to contact me on Twitter, DEV Community or LinkedIn if you have any questions or suggestions.
Or just visit my website to see what I do.