Skip to content

Commit

Permalink
fix :lyft#1218, lyft#1152 - refactor EC2 network interface, private ip (
Browse files Browse the repository at this point in the history
lyft#1219)

Refactors EC2 Network Interfaces and Private IPs to the cartography data
model. Fixes lyft#1152 since the data model includes automatic cleanup jobs.

- Uses same technique as lyft#1214 to represent Network Interfaces as known
by EC2 instances vs Network Interfaces known by
describe-network-interfaces.
- Also clearly marks that the Private IPs ingested here are known by
Network Interfaces and not another source.
  • Loading branch information
achantavy authored and chandan-cl committed Jun 26, 2024
1 parent e0a877c commit 08fd68b
Show file tree
Hide file tree
Showing 17 changed files with 656 additions and 405 deletions.
2 changes: 0 additions & 2 deletions cartography/data/indexes.cypher
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,6 @@ CREATE INDEX IF NOT EXISTS FOR (n:DOProject) ON (n.lastupdated);
CREATE INDEX IF NOT EXISTS FOR (n:EBSSnapshot) ON (n.id);
CREATE INDEX IF NOT EXISTS FOR (n:EBSSnapshot) ON (n.lastupdated);
CREATE INDEX IF NOT EXISTS FOR (n:EC2KeyPair) ON (n.keyfingerprint);
CREATE INDEX IF NOT EXISTS FOR (n:EC2PrivateIp) ON (n.id);
CREATE INDEX IF NOT EXISTS FOR (n:EC2PrivateIp) ON (n.lastupdated);
CREATE INDEX IF NOT EXISTS FOR (n:EC2ReservedInstance) ON (n.id);
CREATE INDEX IF NOT EXISTS FOR (n:EC2ReservedInstance) ON (n.lastupdated);
CREATE INDEX IF NOT EXISTS FOR (n:ECRImage) ON (n.id);
Expand Down

This file was deleted.

12 changes: 6 additions & 6 deletions cartography/intel/aws/ec2/instances.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@
from cartography.intel.aws.ec2.util import get_botocore_config
from cartography.models.aws.ec2.instances import EC2InstanceSchema
from cartography.models.aws.ec2.keypairs import EC2KeyPairSchema
from cartography.models.aws.ec2.networkinterfaces import EC2NetworkInterfaceSchema
from cartography.models.aws.ec2.networkinterface_instance import EC2NetworkInterfaceInstanceSchema
from cartography.models.aws.ec2.reservations import EC2ReservationSchema
from cartography.models.aws.ec2.securitygroups import EC2SecurityGroupSchema
from cartography.models.aws.ec2.subnets import EC2SubnetSchema
from cartography.models.aws.ec2.securitygroup_instance import EC2SecurityGroupInstanceSchema
from cartography.models.aws.ec2.subnet_instance import EC2SubnetInstanceSchema
from cartography.models.aws.ec2.volumes import EBSVolumeInstanceSchema
from cartography.util import aws_handle_regions
from cartography.util import timeit
Expand Down Expand Up @@ -183,7 +183,7 @@ def load_ec2_subnets(
) -> None:
load(
neo4j_session,
EC2SubnetSchema(),
EC2SubnetInstanceSchema(),
subnet_list,
Region=region,
AWS_ID=current_aws_account_id,
Expand Down Expand Up @@ -219,7 +219,7 @@ def load_ec2_security_groups(
) -> None:
load(
neo4j_session,
EC2SecurityGroupSchema(),
EC2SecurityGroupInstanceSchema(),
sg_list,
Region=region,
AWS_ID=current_aws_account_id,
Expand All @@ -237,7 +237,7 @@ def load_ec2_network_interfaces(
) -> None:
load(
neo4j_session,
EC2NetworkInterfaceSchema(),
EC2NetworkInterfaceInstanceSchema(),
network_interface_list,
Region=region,
AWS_ID=current_aws_account_id,
Expand Down
Loading

0 comments on commit 08fd68b

Please sign in to comment.