title: How do I ensure that a Lambda function writes to Cloudwatch Logs on every S3 Put Trigger after deploy?
body: <p>Problem: My lambda function only writes to CloudWatch Logs on the first S3 PUT trigger after deploy.</p>
  <p>Context:
  -Lambda execution role has permissions for CreateLogGroup, PutLogEvents, CreateLogStream, etc. for all resources.
  -Event type: ObjectCreatedByPut on a specific file name in an S3 bucket</p>
  <p>Once I deploy the lambda, the first PUT trigger will successfully execute the lambda, and will also write to CloudWatch Logs. All subsequent PUT actions (uploading a new version of the file) will also successfully execute the lambda, however, it will not write to CloudWatch Logs. The lambda will only write to CloudWatch logs if I redeploy the lambda code, and then upload a new version of the file.</p>
  <p>My assumption is that I would only want to deploy the code once, and then every PUT trigger that occurs after deployment would both execute the lambda and write logs to CW Logs. I'm trying to understand if I am misunderstanding how the lambda triggers + deployment work together, or have I simply configured the lambda improperly?</p>
  <p>Thanks!</p>