To automate invalidations for your CloudFront distribution associated with the S3 bucket follow these step-by-step instructions. This setup will utilize an AWS Lambda function triggered by S3 events to automatically invalidate the CloudFront cache whenever new content is uploaded.
- Access the AWS Management Console and navigate to AWS Lambda.
- Click on Create function.
- Choose Author from scratch.
- Function name: Give your function a meaningful name.
- Runtime: Select Python 3.x
- Click on Create function.