Skip to main content Link Search Menu Expand Document (external link)

ResourceName - awsEc2Instance

Sections
  1. Resource Data
  2. Example
    1. FPL Code
    2. Table Results

The awsEc2Instance resource loads EC2 instances from one or more AWS Account(s). This data will be present when the AWS ResourceWatch integration is enabled.

Resource Data

An example of what this resource includes (JSON):

"@awsEc2Instance": {
    "AmiLaunchIndex": 0,
    "Architecture": "x86_64",
    "BlockDeviceMappings": [
      {
        "DeviceName": "/dev/sda1",
        "Ebs": {
          "AttachTime": "2018-08-11T04:46:46Z",
          "DeleteOnTermination": false,
          "Status": "attached"
        }
      }
    ],
    "CpuOptions": {
      "CoreCount": 1,
      "ThreadsPerCore": 2
    },
    "EbsOptimized": true,
    "Hypervisor": "xen",
    "IamInstanceProfile": null,
    "ImageId": "ami-911138f9",
    "InstanceId": "i-00111117faf1551af",
    "InstanceLifecycle": null,
    "InstanceType": "m5.large",
    "KernelId": null,
    "KeyName": "fluency-east-ohio",
    "LaunchTime": "2021-07-07T21:30:41Z",
    "Monitoring": {
      "State": "disabled"
    },
    "NetworkInterfaces": [
      {
        "Association": {
          "CarrierIp": null,
          "IpOwnerId": "amazon",
          "PublicDnsName": "",
          "PublicIp": "13.14.114.163"
        },
        "Attachment": {
          "AttachTime": "2018-08-11T04:46:46Z",
          "DeleteOnTermination": true,
          "DeviceIndex": 0,
          "NetworkCardIndex": 0,
          "Status": "attached"
        },
        "Description": "Primary network interface",
        "Groups": [
          {
            "GroupId": "sg-11111111e3",
            "GroupName": "etcd-sg"
          }
        ],
        "InterfaceType": "interface",
        "Ipv4Prefixes": null,
        "PrivateDnsName": null,
        "PrivateIpAddress": "10.14.11.9",
        "PrivateIpAddresses": [
          {
            "Association": {
              "CarrierIp": null,
              "IpOwnerId": "amazon",
              "PublicDnsName": "",
              "PublicIp": "13.14.114.163"
            },
            "Primary": true,
            "PrivateDnsName": null,
            "PrivateIpAddress": "10.14.11.9"
          }
        ],
        "SourceDestCheck": true,
        "Status": "in-use",
        "SubnetId": "subnet-0411112e9cfae",
        "VpcId": "vpc-111192"
      }
    ],
    "OutpostArn": null,
    "Placement": {
      "Affinity": null,
      "AvailabilityZone": "us-east-2a",
      "GroupName": "",
      "HostId": null,
      "HostResourceGroupArn": null,
      "PartitionNumber": null,
      "SpreadDomain": null,
      "Tenancy": "default"
    },
    "Platform": null,
    "PrivateDnsName": "ip-10-14-11-9.us-east-2.compute.internal",
    "PrivateIpAddress": "10.14.11.9",
    "PublicIpAddress": "13.14.114.163",
    "RamdiskId": null,
    "RootDeviceName": "/dev/sda1",
    "RootDeviceType": "ebs",

    "SourceDestCheck": true,
    "SpotInstanceRequestId": null,
    "SriovNetSupport": null,
    "State": {
      "Code": 16,
      "Name": "running"
    },
    "StateReason": null,
    "StateTransitionReason": "",
    "Tags": [
      {
        "Key": "Owner",
        "Value": "demo@fluencysecurity.com"
      },
      {
        "Key": "lvdb-app",
        "Value": "master"
      },
      {
        "Key": "Description",
        "Value": "LavaDB master"
      },
      {
        "Key": "lvdb-vpc",
        "Value": "ohio1"
      },
      {
        "Key": "Name",
        "Value": "etcd1.demo"
      }
    ],
    "VirtualizationType": "hvm",
    "_ebsSize": 30,
    "_name": "etcd1.demo",
    "_region": "us-east-2",
    "_volumes": [
      {
        "size": 30,
        "type": "gp2",
        "volumeID": "vol-011111111111"
      }
    ]
  },
  "@customer": "FluencyAudit",
  "@dayIndex": "20221024-18",
  "@key": "i-00111117faf1551af",
  "@resource_type": "awsEc2Instance",
  "@source": "AWSResource",
  "@timestamp": 1666636668000,
  "@type": "resource"
}

Example

FPL Code

An example for showing the basic information of EC2 instance:

function table_loadEc2Instance()
    load resource awsEc2Instance
    let {_name,_region,_ebsSize,InstanceType,KeyName}=f("@awsEc2Instance")
    let {CoreCount}=f("@awsEc2Instance.CpuOptions")
    let {IpOwnerId}=f("@awsEc2Instance.NetworkInterfaces.Association")
    let {Description}=f("@awsEc2Instance.NetworkInterfaces")
end
stream table_loadEc2Instance=table_loadEc2Instance()

Table Results

Results of the above FPL code:

Page last updated: 2022 Oct 27