-
Notifications
You must be signed in to change notification settings - Fork 401
Enhancements in EC2 and Added Support for AMIs #633
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
Enhancements in EC2 and Added Support for AMIs #633
Conversation
# Please enter a commit message to explain why this merge is necessary, # especially if it merges an updated upstream into a topic branch. # # Lines starting with '#' will be ignored, and an empty message aborts # the commit.
…artography into aws-ec2-enhancements
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left a couple of questions but it's looking really good! Thanks for taking this on.
|
||
## EC2Image | ||
|
||
Representation of an AWS [EC2 Images (AMIs)](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/AMIs.html). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's also link to the API doc: https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_Image.html
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
|
||
## AutoScalingGroup | ||
|
||
Representation of an AWS [Auto Scaling Group Resource](https://docs.aws.amazon.com/autoscaling/ec2/userguide/AutoScalingGroup.html). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for including this. Can you also add a link to the AWS API doc?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
cartography/intel/aws/ec2/images.py
Outdated
) -> None: | ||
ingest_images = """ | ||
UNWIND {images_list} as image | ||
MERGE (i:EC2Image{id: image.ImageId}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the ImageId guaranteed to be unique across all AWS like an ARN?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If ImageId
is only unique per region, let's set i.id
to be {ImageId}|{region}
, set i.imageid = {ImageId}
, and also add an index for i.imageid
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cc: @mpurusottamc
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@achantavy AMI ID are unique per region. So, we will follow your suggestion of appending region to the id.
Finding an AMI
Thanks @kedarghule
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@achantavy and @mpurusottamc Changes made and committed 🚀
""" | ||
|
||
# neo4j does not accept datetime objects and values. This loop is used to convert |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: technically not correct anymore as of 3.5 iirc, but it's fine to keep as str()
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah I see. Okay, I'll just remove that comment.
@achantavy All suggested changes as per your review are done here. Anymore changes required? :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very much appreciate the contribution as always @kedarghule :D
Bumps [pytest-cov](https://github.com/pytest-dev/pytest-cov) from 2.10.0 to 6.0.0. <details> <summary>Changelog</summary> <p><em>Sourced from <a href="https://github.com/pytest-dev/pytest-cov/blob/master/CHANGELOG.rst">pytest-cov's changelog</a>.</em></p> <blockquote> <h2>6.0.0 (2024-10-29)</h2> <ul> <li>Updated various documentation inaccuracies, especially on subprocess handling.</li> <li>Changed fail under checks to use the precision set in the coverage configuration. Now it will perform the check just like <code>coverage report</code> would.</li> <li>Added a <code>--cov-precision</code> cli option that can override the value set in your coverage configuration.</li> <li>Dropped support for now EOL Python 3.8.</li> </ul> <h2>5.0.0 (2024-03-24)</h2> <ul> <li>Removed support for xdist rsync (now deprecated). Contributed by Matthias Reichenbach in <code>[#623](pytest-dev/pytest-cov#623) <https://github.com/pytest-dev/pytest-cov/pull/623></code>_.</li> <li>Switched docs theme to Furo.</li> <li>Various legacy Python cleanup and CI improvements. Contributed by Christian Clauss and Hugo van Kemenade in <code>[#630](pytest-dev/pytest-cov#630) <https://github.com/pytest-dev/pytest-cov/pull/630></code><em>, <code>[#631](pytest-dev/pytest-cov#631) <https://github.com/pytest-dev/pytest-cov/pull/631></code></em>, <code>[#632](pytest-dev/pytest-cov#632) <https://github.com/pytest-dev/pytest-cov/pull/632></code>_ and <code>[#633](pytest-dev/pytest-cov#633) <https://github.com/pytest-dev/pytest-cov/pull/633></code>_.</li> <li>Added a <code>pyproject.toml</code> example in the docs. Contributed by Dawn James in <code>[#626](pytest-dev/pytest-cov#626) <https://github.com/pytest-dev/pytest-cov/pull/626></code>_.</li> <li>Modernized project's pre-commit hooks to use ruff. Initial POC contributed by Christian Clauss in <code>[#584](pytest-dev/pytest-cov#584) <https://github.com/pytest-dev/pytest-cov/pull/584></code>_.</li> <li>Dropped support for Python 3.7.</li> </ul> <h2>4.1.0 (2023-05-24)</h2> <ul> <li>Updated CI with new Pythons and dependencies.</li> <li>Removed rsyncdir support. This makes pytest-cov compatible with xdist 3.0. Contributed by Sorin Sbarnea in <code>[#558](pytest-dev/pytest-cov#558) <https://github.com/pytest-dev/pytest-cov/pull/558></code>_.</li> <li>Optimized summary generation to not be performed if no reporting is active (for example, when <code>--cov-report=''</code> is used without <code>--cov-fail-under</code>). Contributed by Jonathan Stewmon in <code>[#589](pytest-dev/pytest-cov#589) <https://github.com/pytest-dev/pytest-cov/pull/589></code>_.</li> <li>Added support for JSON reporting. Contributed by Matthew Gamble in <code>[#582](pytest-dev/pytest-cov#582) <https://github.com/pytest-dev/pytest-cov/pull/582></code>_.</li> <li>Refactored code to use f-strings. Contributed by Mark Mayo in <code>[#572](pytest-dev/pytest-cov#572) <https://github.com/pytest-dev/pytest-cov/pull/572></code>_.</li> <li>Fixed a skip in the test suite for some old xdist. Contributed by a bunch of people in <code>[#565](pytest-dev/pytest-cov#565) <https://github.com/pytest-dev/pytest-cov/pull/565></code>_.</li> <li>Dropped support for Python 3.6.</li> </ul> <h2>4.0.0 (2022-09-28)</h2> <p><strong>Note that this release drops support for multiprocessing.</strong></p> <!-- raw HTML omitted --> </blockquote> <p>... (truncated)</p> </details> <details> <summary>Commits</summary> <ul> <li><a href="https://github.com/pytest-dev/pytest-cov/commit/95404375a0e436178e012e20b8865c23c54c8a50"><code>9540437</code></a> Bump version: 5.0.0 → 6.0.0</li> <li><a href="https://github.com/pytest-dev/pytest-cov/commit/9f8175467afc67db9001fb364ad1f2dfe79b51f1"><code>9f81754</code></a> Further trim down envs and drop Python 3.8.</li> <li><a href="https://github.com/pytest-dev/pytest-cov/commit/b12b5ec65da4c66bbc0c35918957f9f875f465c3"><code>b12b5ec</code></a> Update conf.</li> <li><a href="https://github.com/pytest-dev/pytest-cov/commit/23f4b27b432a54fcc3b6df7363f0e73e568233fb"><code>23f4b27</code></a> Update changelog.</li> <li><a href="https://github.com/pytest-dev/pytest-cov/commit/291a04f49566054bb19644aba27c3799ac8b7f42"><code>291a04f</code></a> Bump test deps and trim config.</li> <li><a href="https://github.com/pytest-dev/pytest-cov/commit/08f1101455ba293dda388fdb3b61e62fd95a827d"><code>08f1101</code></a> Add <code>--cov-precision</code> option. Close <a href="https://redirect.github.com/pytest-dev/pytest-cov/issues/655">#655</a>.</li> <li><a href="https://github.com/pytest-dev/pytest-cov/commit/76fe2a7e48e5c9c53644994c5ba5a421c84286f5"><code>76fe2a7</code></a> Move the warnings/errors in a place that doesn't import anything.</li> <li><a href="https://github.com/pytest-dev/pytest-cov/commit/a9ea7b71711479d4c5ccc5e21e2eb1694b259cb0"><code>a9ea7b7</code></a> Implement error/warning for the bad dynamic_context being set in config.</li> <li><a href="https://github.com/pytest-dev/pytest-cov/commit/c299e01b6422284a6a7f7322e6b9bf8f44aa3c25"><code>c299e01</code></a> Add explicit suffixing to make it easier to see the identify the sources/usag...</li> <li><a href="https://github.com/pytest-dev/pytest-cov/commit/c87e54643ef696ed2b0e2b9a4209581da8467fcb"><code>c87e546</code></a> Add reproducer for weird xdist dynamic_context interaction. Ref <a href="https://redirect.github.com/pytest-dev/pytest-cov/issues/604">#604</a>.</li> <li>Additional commits viewable in <a href="https://github.com/pytest-dev/pytest-cov/compare/v2.10.0...v6.0.0">compare view</a></li> </ul> </details> <br /> [](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) --- <details> <summary>Dependabot commands and options</summary> <br /> You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot show <dependency name> ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself) </details> Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: i_virus <[email protected]>
This PR does the following:
Currently the auto_scaling_groups.py code does not use the UNWIND approach, instead it uses loops to populate the AWS resources. This PR rectifies that. Additionally, some more attributes of AutoScalingGroups are populated.
Some additional useful attributes missing from EC2 Instances and Subnets get populated too! Corresponding changes have been made in the documentation. (I specifically didn't add the UNWIND approach here because I wasn't quite sure of the code structure here and I didn't want to break things 🙈)
The documentation for Auto Scaling Groups was missing all this while. Added it!
And the one major update in this PR is - Added support for Amazon Machine Images (AMIs) - images.py in the ec2 folder.