Skip to content

Instantly share code, notes, and snippets.

@gforien
Last active November 18, 2021 13:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gforien/6754e95625cbb65524cd083e933aa6fb to your computer and use it in GitHub Desktop.
Save gforien/6754e95625cbb65524cd083e933aa6fb to your computer and use it in GitHub Desktop.
Get a count of all AWS EC2 commands
# PS> aws ec2 help | write
$commands = @(
@{n='accept-transit-gateway-multicast-domain-associations'}, @{n='accept-transit-gateway-peering-attachment '},
@{n='accept-transit-gateway-vpc-attachment'}, @{n='accept-vpc-endpoint-connections'},
@{n='accept-vpc-peering-connection'}, @{n='advertise-byoip-cidr'},
@{n='allocate-address'}, @{n='allocate-hosts'},
@{n='apply-security-groups-to-client-vpn-target-network'}, @{n='assign-ipv6-addresses'},
@{n='assign-private-ip-addresses'}, @{n='associate-address'},
@{n='associate-client-vpn-target-network'}, @{n='associate-dhcp-options'},
@{n='associate-enclave-certificate-iam-role'}, @{n='associate-iam-instance-profile'},
@{n='associate-instance-event-window'}, @{n='associate-route-table'},
@{n='associate-subnet-cidr-block'}, @{n='associate-transit-gateway-multicast-domain '},
@{n='associate-transit-gateway-route-table'}, @{n='associate-trunk-interface'},
@{n='associate-vpc-cidr-block'}, @{n='attach-classic-link-vpc'},
@{n='attach-internet-gateway'}, @{n='attach-network-interface'},
@{n='attach-volume'}, @{n='attach-vpn-gateway'},
@{n='authorize-client-vpn-ingress'}, @{n='authorize-security-group-egress'},
@{n='authorize-security-group-ingress'}, @{n='bundle-instance'},
@{n='cancel-bundle-task'}, @{n='cancel-capacity-reservation'},
@{n='cancel-capacity-reservation-fleets'}, @{n='cancel-conversion-task'},
@{n='cancel-export-task'}, @{n='cancel-import-task'},
@{n='cancel-reserved-instances-listing'}, @{n='cancel-spot-fleet-requests'},
@{n='cancel-spot-instance-requests'}, @{n='confirm-product-instance'},
@{n='copy-fpga-image'}, @{n='copy-image'},
@{n='copy-snapshot'}, @{n='create-capacity-reservation'},
@{n='create-capacity-reservation-fleet'}, @{n='create-carrier-gateway'},
@{n='create-client-vpn-endpoint'}, @{n='create-client-vpn-route'},
@{n='create-customer-gateway'}, @{n='create-default-subnet'},
@{n='create-default-vpc'}, @{n='create-dhcp-options'},
@{n='create-egress-only-internet-gateway'}, @{n='create-fleet'},
@{n='create-flow-logs'}, @{n='create-fpga-image'},
@{n='create-image'}, @{n='create-instance-event-window'},
@{n='create-instance-export-task'}, @{n='create-internet-gateway'},
@{n='create-key-pair'}, @{n='create-launch-template'},
@{n='create-launch-template-version'}, @{n='create-local-gateway-route'},
@{n='create-local-gateway-route-table-vpc-association'}, @{n='create-managed-prefix-list'},
@{n='create-nat-gateway'}, @{n='create-network-acl'},
@{n='create-network-acl-entry'}, @{n='create-network-insights-path'},
@{n='create-network-interface'}, @{n='create-network-interface-permission'},
@{n='create-placement-group'}, @{n='create-replace-root-volume-task'},
@{n='create-reserved-instances-listing'}, @{n='create-restore-image-task'},
@{n='create-route'}, @{n='create-route-table'},
@{n='create-security-group'}, @{n='create-snapshot'},
@{n='create-snapshots'}, @{n='create-spot-datafeed-subscription'},
@{n='create-store-image-task'}, @{n='create-subnet'},
@{n='create-subnet-cidr-reservation'}, @{n='create-tags'},
@{n='create-traffic-mirror-filter'}, @{n='create-traffic-mirror-filter-rule'},
@{n='create-traffic-mirror-session'}, @{n='create-traffic-mirror-target'},
@{n='create-transit-gateway'}, @{n='create-transit-gateway-connect'},
@{n='create-transit-gateway-connect-peer'}, @{n='create-transit-gateway-multicast-domain '},
@{n='create-transit-gateway-peering-attachment'}, @{n='create-transit-gateway-prefix-list-reference '},
@{n='create-transit-gateway-route'}, @{n='create-transit-gateway-route-table'},
@{n='create-transit-gateway-vpc-attachment'}, @{n='create-volume'},
@{n='create-vpc'}, @{n='create-vpc-endpoint'},
@{n='create-vpc-endpoint-connection-notification'}, @{n='create-vpc-endpoint-service-configuration '},
@{n='create-vpc-peering-connection'}, @{n='create-vpn-connection'},
@{n='create-vpn-connection-route'}, @{n='create-vpn-gateway'},
@{n='delete-carrier-gateway'}, @{n='delete-client-vpn-endpoint'},
@{n='delete-client-vpn-route'}, @{n='delete-customer-gateway'},
@{n='delete-dhcp-options'}, @{n='delete-egress-only-internet-gateway'},
@{n='delete-fleets'}, @{n='delete-flow-logs'},
@{n='delete-fpga-image'}, @{n='delete-instance-event-window'},
@{n='delete-internet-gateway'}, @{n='delete-key-pair'},
@{n='delete-launch-template'}, @{n='delete-launch-template-versions'},
@{n='delete-local-gateway-route'}, @{n='delete-local-gateway-route-table-vpc-association '},
@{n='delete-managed-prefix-list'}, @{n='delete-nat-gateway'},
@{n='delete-network-acl'}, @{n='delete-network-acl-entry'},
@{n='delete-network-insights-analysis'}, @{n='delete-network-insights-path'},
@{n='delete-network-interface'}, @{n='delete-network-interface-permission'},
@{n='delete-placement-group'}, @{n='delete-queued-reserved-instances'},
@{n='delete-route'}, @{n='delete-route-table'},
@{n='delete-security-group'}, @{n='delete-snapshot'},
@{n='delete-spot-datafeed-subscription'}, @{n='delete-subnet'},
@{n='delete-subnet-cidr-reservation'}, @{n='delete-tags'},
@{n='delete-traffic-mirror-filter'}, @{n='delete-traffic-mirror-filter-rule'},
@{n='delete-traffic-mirror-session'}, @{n='delete-traffic-mirror-target'},
@{n='delete-transit-gateway'}, @{n='delete-transit-gateway-connect'},
@{n='delete-transit-gateway-connect-peer'}, @{n='delete-transit-gateway-multicast-domain '},
@{n='delete-transit-gateway-peering-attachment'}, @{n='delete-transit-gateway-prefix-list-reference '},
@{n='delete-transit-gateway-route'}, @{n='delete-transit-gateway-route-table'},
@{n='delete-transit-gateway-vpc-attachment'}, @{n='delete-volume'},
@{n='delete-vpc'}, @{n='delete-vpc-endpoint-connection-notifications '},
@{n='delete-vpc-endpoint-service-configurations'}, @{n='delete-vpc-endpoints'},
@{n='delete-vpc-peering-connection'}, @{n='delete-vpn-connection'},
@{n='delete-vpn-connection-route'}, @{n='delete-vpn-gateway'},
@{n='deprovision-byoip-cidr'}, @{n='deregister-image'},
@{n='deregister-instance-event-notification-attributes'}, @{n='deregister-transit-gateway-multicast-group-members '},
@{n='deregister-transit-gateway-multicast-group-sources'}, @{n='describe-account-attributes'},
@{n='describe-addresses'}, @{n='describe-addresses-attribute'},
@{n='describe-aggregate-id-format'}, @{n='describe-availability-zones'},
@{n='describe-bundle-tasks'}, @{n='describe-byoip-cidrs'},
@{n='describe-capacity-reservation-fleets'}, @{n='describe-capacity-reservations'},
@{n='describe-carrier-gateways'}, @{n='describe-classic-link-instances'},
@{n='describe-client-vpn-authorization-rules'}, @{n='describe-client-vpn-connections'},
@{n='describe-client-vpn-endpoints'}, @{n='describe-client-vpn-routes'},
@{n='describe-client-vpn-target-networks'}, @{n='describe-coip-pools'},
@{n='describe-conversion-tasks'}, @{n='describe-customer-gateways'},
@{n='describe-dhcp-options'}, @{n='describe-egress-only-internet-gateways'},
@{n='describe-elastic-gpus'}, @{n='describe-export-image-tasks'},
@{n='describe-export-tasks'}, @{n='describe-fast-snapshot-restores'},
@{n='describe-fleet-history'}, @{n='describe-fleet-instances'},
@{n='describe-fleets'}, @{n='describe-flow-logs'},
@{n='describe-fpga-image-attribute'}, @{n='describe-fpga-images'},
@{n='describe-host-reservation-offerings'}, @{n='describe-host-reservations'},
@{n='describe-hosts'}, @{n='describe-iam-instance-profile-associations '},
@{n='describe-id-format'}, @{n='describe-identity-id-format'},
@{n='describe-image-attribute'}, @{n='describe-images'},
@{n='describe-import-image-tasks'}, @{n='describe-import-snapshot-tasks'},
@{n='describe-instance-attribute'}, @{n='describe-instance-credit-specifications '},
@{n='describe-instance-event-notification-attributes'}, @{n='describe-instance-event-windows'},
@{n='describe-instance-status'}, @{n='describe-instance-type-offerings'},
@{n='describe-instance-types'}, @{n='describe-instances'},
@{n='describe-internet-gateways'}, @{n='describe-ipv6-pools'},
@{n='describe-key-pairs'}, @{n='describe-launch-template-versions'},
@{n='describe-launch-templates'}, @{n='describe-local-gateway-route-table-virtual-interface-group-associations '},
@{n='describe-local-gateway-route-table-vpc-associations'}, @{n='describe-local-gateway-route-tables'},
@{n='describe-local-gateway-virtual-interface-groups'}, @{n='describe-local-gateway-virtual-interfaces '},
@{n='describe-local-gateways'}, @{n='describe-managed-prefix-lists'},
@{n='describe-moving-addresses'}, @{n='describe-nat-gateways'},
@{n='describe-network-acls'}, @{n='describe-network-insights-analyses'},
@{n='describe-network-insights-paths'}, @{n='describe-network-interface-attribute'},
@{n='describe-network-interface-permissions'}, @{n='describe-network-interfaces'},
@{n='describe-placement-groups'}, @{n='describe-prefix-lists'},
@{n='describe-principal-id-format'}, @{n='describe-public-ipv4-pools'},
@{n='describe-regions'}, @{n='describe-replace-root-volume-tasks'},
@{n='describe-reserved-instances'}, @{n='describe-reserved-instances-listings'},
@{n='describe-reserved-instances-modifications'}, @{n='describe-reserved-instances-offerings'},
@{n='describe-route-tables'}, @{n='describe-scheduled-instance-availability '},
@{n='describe-scheduled-instances'}, @{n='describe-security-group-references'},
@{n='describe-security-group-rules'}, @{n='describe-security-groups'},
@{n='describe-snapshot-attribute'}, @{n='describe-snapshots'},
@{n='describe-spot-datafeed-subscription'}, @{n='describe-spot-fleet-instances'},
@{n='describe-spot-fleet-request-history'}, @{n='describe-spot-fleet-requests'},
@{n='describe-spot-instance-requests'}, @{n='describe-spot-price-history'},
@{n='describe-stale-security-groups'}, @{n='describe-store-image-tasks'},
@{n='describe-subnets'}, @{n='describe-tags'},
@{n='describe-traffic-mirror-filters'}, @{n='describe-traffic-mirror-sessions'},
@{n='describe-traffic-mirror-targets'}, @{n='describe-transit-gateway-attachments'},
@{n='describe-transit-gateway-connect-peers'}, @{n='describe-transit-gateway-connects'},
@{n='describe-transit-gateway-multicast-domains'}, @{n='describe-transit-gateway-peering-attachments '},
@{n='describe-transit-gateway-route-tables'}, @{n='describe-transit-gateway-vpc-attachments '},
@{n='describe-transit-gateways'}, @{n='describe-trunk-interface-associations'},
@{n='describe-volume-attribute'}, @{n='describe-volume-status'},
@{n='describe-volumes'}, @{n='describe-volumes-modifications'},
@{n='describe-vpc-attribute'}, @{n='describe-vpc-classic-link'},
@{n='describe-vpc-classic-link-dns-support'}, @{n='describe-vpc-endpoint-connection-notifications '},
@{n='describe-vpc-endpoint-connections'}, @{n='describe-vpc-endpoint-service-configurations '},
@{n='describe-vpc-endpoint-service-permissions'}, @{n='describe-vpc-endpoint-services'},
@{n='describe-vpc-endpoints'}, @{n='describe-vpc-peering-connections'},
@{n='describe-vpcs'}, @{n='describe-vpn-connections'},
@{n='describe-vpn-gateways'}, @{n='detach-classic-link-vpc'},
@{n='detach-internet-gateway'}, @{n='detach-network-interface'},
@{n='detach-volume'}, @{n='detach-vpn-gateway'},
@{n='disable-ebs-encryption-by-default'}, @{n='disable-fast-snapshot-restores'},
@{n='disable-image-deprecation'}, @{n='disable-serial-console-access'},
@{n='disable-transit-gateway-route-table-propagation'}, @{n='disable-vgw-route-propagation'},
@{n='disable-vpc-classic-link'}, @{n='disable-vpc-classic-link-dns-support'},
@{n='disassociate-address'}, @{n='disassociate-client-vpn-target-network'},
@{n='disassociate-enclave-certificate-iam-role'}, @{n='disassociate-iam-instance-profile'},
@{n='disassociate-instance-event-window'}, @{n='disassociate-route-table'},
@{n='disassociate-subnet-cidr-block'}, @{n='disassociate-transit-gateway-multicast-domain '},
@{n='disassociate-transit-gateway-route-table'}, @{n='disassociate-trunk-interface'},
@{n='disassociate-vpc-cidr-block'}, @{n='enable-ebs-encryption-by-default'},
@{n='enable-fast-snapshot-restores'}, @{n='enable-image-deprecation'},
@{n='enable-serial-console-access'}, @{n='enable-transit-gateway-route-table-propagation '},
@{n='enable-vgw-route-propagation'}, @{n='enable-volume-io'},
@{n='enable-vpc-classic-link'}, @{n='enable-vpc-classic-link-dns-support'},
@{n='export-client-vpn-client-certificate-revocation-list'}, @{n='export-client-vpn-client-configuration'},
@{n='export-image'}, @{n='export-transit-gateway-routes'},
@{n='get-associated-enclave-certificate-iam-roles'}, @{n='get-associated-ipv6-pool-cidrs'},
@{n='get-capacity-reservation-usage'}, @{n='get-coip-pool-usage'},
@{n='get-console-output'}, @{n='get-console-screenshot'},
@{n='get-default-credit-specification'}, @{n='get-ebs-default-kms-key-id'},
@{n='get-ebs-encryption-by-default'}, @{n='get-flow-logs-integration-template'},
@{n='get-groups-for-capacity-reservation'}, @{n='get-host-reservation-purchase-preview'},
@{n='get-instance-types-from-instance-requirements'}, @{n='get-launch-template-data'},
@{n='get-managed-prefix-list-associations'}, @{n='get-managed-prefix-list-entries'},
@{n='get-password-data'}, @{n='get-reserved-instances-exchange-quote'},
@{n='get-serial-console-access-status'}, @{n='get-spot-placement-scores'},
@{n='get-subnet-cidr-reservations'}, @{n='get-transit-gateway-attachment-propagations '},
@{n='get-transit-gateway-multicast-domain-associations'}, @{n='get-transit-gateway-prefix-list-references '},
@{n='get-transit-gateway-route-table-associations'}, @{n='get-transit-gateway-route-table-propagations '},
@{n='get-vpn-connection-device-sample-configuration'}, @{n='get-vpn-connection-device-types'},
@{n='import-client-vpn-client-certificate-revocation-list'}, @{n='import-image'},
@{n='import-key-pair'}, @{n='import-snapshot'},
@{n='modify-address-attribute'}, @{n='modify-availability-zone-group'},
@{n='modify-capacity-reservation'}, @{n='modify-capacity-reservation-fleet'},
@{n='modify-client-vpn-endpoint'}, @{n='modify-default-credit-specification'},
@{n='modify-ebs-default-kms-key-id'}, @{n='modify-fleet'},
@{n='modify-fpga-image-attribute'}, @{n='modify-hosts'},
@{n='modify-id-format'}, @{n='modify-identity-id-format'},
@{n='modify-image-attribute'}, @{n='modify-instance-attribute'},
@{n='modify-instance-capacity-reservation-attributes'}, @{n='modify-instance-credit-specification'},
@{n='modify-instance-event-start-time'}, @{n='modify-instance-event-window'},
@{n='modify-instance-metadata-options'}, @{n='modify-instance-placement'},
@{n='modify-launch-template'}, @{n='modify-managed-prefix-list'},
@{n='modify-network-interface-attribute'}, @{n='modify-reserved-instances'},
@{n='modify-security-group-rules'}, @{n='modify-snapshot-attribute'},
@{n='modify-spot-fleet-request'}, @{n='modify-subnet-attribute'},
@{n='modify-traffic-mirror-filter-network-services'}, @{n='modify-traffic-mirror-filter-rule'},
@{n='modify-traffic-mirror-session'}, @{n='modify-transit-gateway'},
@{n='modify-transit-gateway-prefix-list-reference'}, @{n='modify-transit-gateway-vpc-attachment'},
@{n='modify-volume'}, @{n='modify-volume-attribute'},
@{n='modify-vpc-attribute'}, @{n='modify-vpc-endpoint'},
@{n='modify-vpc-endpoint-connection-notification'}, @{n='modify-vpc-endpoint-service-configuration '},
@{n='modify-vpc-endpoint-service-permissions'}, @{n='modify-vpc-peering-connection-options'},
@{n='modify-vpc-tenancy'}, @{n='modify-vpn-connection'},
@{n='modify-vpn-connection-options'}, @{n='modify-vpn-tunnel-certificate'},
@{n='modify-vpn-tunnel-options'}, @{n='monitor-instances'},
@{n='move-address-to-vpc'}, @{n='provision-byoip-cidr'},
@{n='purchase-host-reservation'}, @{n='purchase-reserved-instances-offering'},
@{n='purchase-scheduled-instances'}, @{n='reboot-instances'},
@{n='register-image'}, @{n='register-instance-event-notification-attributes '},
@{n='register-transit-gateway-multicast-group-members'}, @{n='register-transit-gateway-multicast-group-sources '},
@{n='reject-transit-gateway-multicast-domain-associations'}, @{n='reject-transit-gateway-peering-attachment '},
@{n='reject-transit-gateway-vpc-attachment'}, @{n='reject-vpc-endpoint-connections'},
@{n='reject-vpc-peering-connection'}, @{n='release-address'},
@{n='release-hosts'}, @{n='replace-iam-instance-profile-association '},
@{n='replace-network-acl-association'}, @{n='replace-network-acl-entry'},
@{n='replace-route'}, @{n='replace-route-table-association'},
@{n='replace-transit-gateway-route'}, @{n='report-instance-status'},
@{n='request-spot-fleet'}, @{n='request-spot-instances'},
@{n='reset-address-attribute'}, @{n='reset-ebs-default-kms-key-id'},
@{n='reset-fpga-image-attribute'}, @{n='reset-image-attribute'},
@{n='reset-instance-attribute'}, @{n='reset-network-interface-attribute'},
@{n='reset-snapshot-attribute'}, @{n='restore-address-to-classic'},
@{n='restore-managed-prefix-list-version'}, @{n='revoke-client-vpn-ingress'},
@{n='revoke-security-group-egress'}, @{n='revoke-security-group-ingress'},
@{n='run-instances'}, @{n='run-scheduled-instances'},
@{n='search-local-gateway-routes'}, @{n='search-transit-gateway-multicast-groups '},
@{n='search-transit-gateway-routes'}, @{n='send-diagnostic-interrupt'},
@{n='start-instances'}, @{n='start-network-insights-analysis'},
@{n='start-vpc-endpoint-service-private-dns-verification'}, @{n='stop-instances'},
@{n='terminate-client-vpn-connections'}, @{n='terminate-instances'},
@{n='unassign-ipv6-addresses'}, @{n='unassign-private-ip-addresses'},
@{n='unmonitor-instances'}, @{n='update-security-group-rule-descriptions-egress '},
@{n='update-security-group-rule-descriptions-ingress'}, @{n='withdraw-byoip-cidr'},
@{n='accept-reserved-instances-exchange-quote'}, @{n='wait'}
)
$actions = @(
'create', 'associate', 'attach', 'enable',
'import', 'export', 'get', 'describe',
'modify', 'replace', 'delete', 'cancel',
'detach', 'disable', 'disassociate',
'revoke', 'unassign', 'terminate'
)
$actions | %{
$count = ($commands | select n | where n -match $_).Count;
[pscustomobject]@{Command=$_;Count=$count}
} | sort Count -desc
<#
Old version with foreach
$result = foreach ($i in $actions) {
$count = ($commands | select Name | where Name -match $i).Count
[pscustomobject]@{Command=$i;Count=$count}
}
$result | sort Count -Descending
#>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment