I am using ansible-playbook to apply life cycle management on S3 bucket. Below is the ansible task.
- name: Configure a lifecycle
community.aws.s3_lifecycle:
name: "{{ bucketName }}"
expiration_days: 30
aws_access_key: "{{ accessKey }}"
aws_secret_key: "{{ secretKey }}"
ec2_url: "{{ endPoint }}"
status: enabled
state: present
validate_certs: false
However I am getting below error msg while I am running ansible task. Do I miss anything here?
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: botocore.exceptions.ClientError: An error occurred (NoSuchBucketPolicy) when calling the GetBucketLifecycleConfiguration operation: The bucket policy does not exist.
fatal: [localhost]: FAILED! => {"boto3_version": "1.23.10", "botocore_version": "1.26.10", "changed": false, "error": {"code": "NoSuchBucketPolicy", "message": "The bucket policy does not exist.", "resource": "test191"}, "msg": "An error occurred (NoSuchBucketPolicy) when calling the GetBucketLifecycleConfiguration operation: The bucket policy does not exist.