0

I'm fairly new to both Python and AWS, so I'm trying to get some advice on how to best approach this problem.

I have a Python script that I run locally and it targets a production AWS environment. The script will show me certain errors. I have a read-only account to be able to run this script.

I'd like to be able to automate this so it runs the script maybe hourly and sends an email with the output.

After some research, I thought maybe a Lambda function would work. However, I need to be able to run the script from an AWS environment separate from the one I'm targeting. The reason is I don't have (or want) to add or change anything in the production environment. However, I do have access to a separate environment.

Is Lambda even the best way? If not, what is the most efficient way to achieve this?

spex5
  • 1,221
  • 4
  • 17
  • 27
  • I never did it but depending of the info you need you can use AWS API so you don't need execute any script and this will maybe skip the permission problem – Carlo 1585 Mar 21 '19 at 15:12

1 Answers1

0

To run the job hourly, you can create a CloudWatch Events Rule with a schedule (cron expression) and add the Lambda function as the target.

This lambda function may execute the python script in concern. If from the Python script, you are invoking some AWS API actions on the resources of your production account, you would need to allow cross-account access. You can find more details around that here: Cross account role for an AWS Lambda function

Ujjwal Bhardwaj
  • 725
  • 5
  • 11