Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cloudtrail: Also make onCloudTrailEvent a static method #6716

Closed
psyphdawg opened this issue Mar 13, 2020 · 2 comments · Fixed by #8076
Closed

cloudtrail: Also make onCloudTrailEvent a static method #6716

psyphdawg opened this issue Mar 13, 2020 · 2 comments · Fixed by #8076
Assignees
Labels
@aws-cdk/aws-cloudtrail Related to AWS CloudTrail effort/small Small work item – less than a day of effort feature-request A feature should be added or improved. good first issue Related to contributions. See CONTRIBUTING.md

Comments

@psyphdawg
Copy link

❓ Can you add a mthod to import an existing cloud trail into the stack?

The Question

Can you add an import/lookup method to the trail construct?

I have been tasked with multiple projects to fire to lambda based on cloud trail events. Each time I have had to create a new trail because thre is no lookup method. Is there currently a work around? We have already reached out hard cap of 5 trails.

Thanks

Environment

  • CDK CLI Version: 1.26.0
  • Module Version: 1.26.0
  • OS: all
  • Language: all

Other information

AWS has a hard limit of 5 cloud trails per account. Not having a method to import existing trails on the trail construct really limits what you can do with this service in CDK.

@SomayaB SomayaB added guidance Question that needs advice or information. @aws-cdk/aws-cloudtrail Related to AWS CloudTrail labels Mar 13, 2020
@rix0rrr
Copy link
Contributor

rix0rrr commented Mar 16, 2020

You are unlikely to need to import trails into CDK. If you do, there is an issue with the construct library. Most of the event based methods don't actually require THE trail, just A trail be present in the account.

As a workaround, you should probably just emulate what onCloudTrailEvent does and create a Rule object directly:

https://github.com/aws/aws-cdk/blob/master/packages/@aws-cdk/aws-cloudtrail/lib/index.ts#L259

@rix0rrr rix0rrr added effort/small Small work item – less than a day of effort feature-request A feature should be added or improved. good first issue Related to contributions. See CONTRIBUTING.md and removed guidance Question that needs advice or information. labels Mar 16, 2020
@rix0rrr rix0rrr changed the title Cannot import existing cloud trail into CDK stack cloudtrail: Also make onCloudTrailEvent a static method Mar 16, 2020
@psyphdawg
Copy link
Author

psyphdawg commented Mar 19, 2020 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/aws-cloudtrail Related to AWS CloudTrail effort/small Small work item – less than a day of effort feature-request A feature should be added or improved. good first issue Related to contributions. See CONTRIBUTING.md
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants