Repository: cloud-custodian/cloud-custodian

Issue:
aws.s3 - CreationDate is unavailable in cloudtrail policies
**Describe the bug**
The `CreationDate` field is not available for s3 cloudtrail policies and therefore cannot include filters depending on the age of the bucket.  Because the data is missing, the filter will not behave as expected and will simply never match.

Filtering based on age `lt` 1 day:
```
[DEBUG]	2020-05-14T15:29:08.869Z	8c3d8f81-3b5b-4d44-81ac-756c81a7dab0 Filtered from 1 to 0 s3
```
Filtering based on age `gt` 1 day:
```
[DEBUG]	2020-05-14T15:30:22.160Z	eac7440b-60ad-487e-987e-cfe5f56501c0 Filtered from 1 to 0 s3
```
This also affects the reporting abilities during notifications... as we cannot report on when the bucket was created.

This looks directly related to #3909

**To Reproduce**
Provision any cloudtrail policy for s3 and try to use the `CreationDate` field.

**Expected behavior**
`CreationDate` should be available during event/lambda policies.

**Background (please complete the following information):**
 - Custodian Version: 0.9.1
 - Policy:
```yaml
policies: 
  - name: test-s3-age
    resource: s3
    mode:
      type: cloudtrail
      events:
        - source: s3.amazonaws.com
          event: PutBucketTagging
          ids: requestParameters.bucketName
      role: *lambda-role
      tags: *lambda-tags
    filters:
      - type: value
        key: CreationDate
        op: gt
        value_type: age
        value: 1
```

Discussion:
kapilt: lgtm, can we add an assertion to the test for creation date presence

Patch:
diff --git a/c7n/resources/s3.py b/c7n/resources/s3.py
index cfbb0726d..c4cb63203 100644
--- a/c7n/resources/s3.py
+++ b/c7n/resources/s3.py
@@ -97,9 +97,6 @@ class DescribeS3(query.DescribeSource):
             results = list(filter(None, results))
             return results
 
-    def get_resources(self, bucket_names):
-        return [{'Name': b} for b in bucket_names]
-
 
 class ConfigS3(query.ConfigSource):
 


Test patch:
diff --git a/tests/data/placebo/test_s3_get_resources/s3.ListBuckets_1.json b/tests/data/placebo/test_s3_get_resources/s3.ListBuckets_1.json
new file mode 100644
index 000000000..ccd215d70
--- /dev/null
+++ b/tests/data/placebo/test_s3_get_resources/s3.ListBuckets_1.json
@@ -0,0 +1,25 @@
+{
+    "status_code": 200,
+    "data": {
+        "ResponseMetadata": {},
+        "Buckets": [
+            {
+                "Name": "c7n-codebuild",
+                "CreationDate": {
+                    "__class__": "datetime",
+                    "year": 2019,
+                    "month": 12,
+                    "day": 20,
+                    "hour": 23,
+                    "minute": 0,
+                    "second": 14,
+                    "microsecond": 0
+                }
+            }
+        ],
+        "Owner": {
+            "DisplayName": "custodian-skunkworks",
+            "ID": "631e4e145c2211ed2e31307ba841b1862307d16de5eab6f5399a23bbbecc26e2"
+        }
+    }
+}
diff --git a/tests/test_s3.py b/tests/test_s3.py
index f07261097..c00c9b194 100644
--- a/tests/test_s3.py
+++ b/tests/test_s3.py
@@ -1272,6 +1272,7 @@ class S3Test(BaseTest):
             tags, {
                 'Application': 'test', 'Env': 'Dev', 'Owner': 'nicholase',
                 'Retention': '2', 'Retention2': '3', 'test': 'test'})
+        self.assertTrue("CreationDate" in resources[0])
 
     def test_multipart_large_file(self):
         self.patch(s3.S3, "executor_factory", MainThreadExecutor)