{"id":20550421,"url":"https://github.com/dnmfarrell/aws-ip","last_synced_at":"2026-04-25T05:33:58.215Z","repository":{"id":27262371,"uuid":"30734924","full_name":"dnmfarrell/AWS-IP","owner":"dnmfarrell","description":"Get and search AWS IP ranges in a caching, auto-refreshing way","archived":false,"fork":false,"pushed_at":"2018-11-01T00:37:39.000Z","size":24,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-16T16:49:59.949Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Perl","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dnmfarrell.png","metadata":{"files":{"readme":"README.pod","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-02-13T01:39:32.000Z","updated_at":"2018-11-01T00:37:40.000Z","dependencies_parsed_at":"2022-07-18T10:39:30.076Z","dependency_job_id":null,"html_url":"https://github.com/dnmfarrell/AWS-IP","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dnmfarrell%2FAWS-IP","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dnmfarrell%2FAWS-IP/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dnmfarrell%2FAWS-IP/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dnmfarrell%2FAWS-IP/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dnmfarrell","download_url":"https://codeload.github.com/dnmfarrell/AWS-IP/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242157180,"owners_count":20081036,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-16T02:24:55.124Z","updated_at":"2026-04-25T05:33:58.186Z","avatar_url":"https://github.com/dnmfarrell.png","language":"Perl","funding_links":[],"categories":[],"sub_categories":[],"readme":"=head2 SYNOPSIS\n\n  use AWS::IP;\n\n  my $aws = AWS::IP-\u003enew(600, '/tmp/aws_ip_cache');\n\n  # get the raw data as a Perl reference\n  my $aws_ip_data = $aws-\u003eget_raw_data;\n\n  # check if an ip address is AWS\n  if ($aws-\u003eis_aws_ip('50.0.0.1')\n  {\n    ..\n  }\n\n  # get a list of all AWS cidrs\n  my $cidrs = $aws-\u003eget_cidrs;\n\n  for (@$cidrs)\n  {\n    ...\n  }\n\n  # create your own ip checks\n  use Net::CIDR::Set;\n\n  my $ec2_cidrs = $aws-\u003eget_cidrs_by_service('EC2');\n  my $aws_ec2_set = Net::CIDR::Set-\u003enew( @$ec2_cidrs );\n\n  if ($aws_ec2_set-\u003econtains($ip)\n  {\n    ...\n  }\n\n  # time passes, cache has expired\n  $aws_ip_data = $aws-\u003eget_raw_data; # auto refreshes\n\n=head2 DESCRIPTION\n\nAWS L\u003cpublish|https://ip-ranges.amazonaws.com/ip-ranges.json\u003e their IP ranges, which periodically change. This module downloads and serializes the IP ranges into a Perl data hash reference. It caches the data, and if the cache expires, re-downloads a new version. This can be helpful if you want to block all AWS IP addresses and periodically refresh the blocked IPs.\n\n=head2 new ($cache_timeout_secs, [$cache_path])\n\nCreates a new AWS::IP object and sets up the cache. Requires an number for the cache timeout seconds. Optionally takes a cache path argument. If no cache path is supplied, AWS::IP will use a random temp directory. If you want to reuse the cache over multiple processes, provide a cache path.\n\n\n=cut\n\n=head2 ip_is_aws ($ip, [$service])\n\nBoolean method to test if an ip address is from AWS. Optionally takes a service name (AMAZON|EC2|CLOUDFRONT|ROUTE53|ROUTE53_HEALTHCHECKS) and restricts the check to AWS ip addresses for that service.\n\nIf you are checking more than one ip address, it's more efficient to pull the CIDRs you want, then use L\u003cNet::CIDR::Set\u003e to test if the ips are present in the CIDRs (see example in SYNOPSIS).\n\n\n=cut\n\n=head2 get_raw_data\n\nReturns the entire raw IP dataset as a Perl data structure.\n\n\n=cut\n\n=head2 get_cidrs\n\nReturns an arrayref of the L\u003cCIDRs|http://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing\u003e in the AWS IP address data.\n\n\n=cut\n\n=head2 get_cidrs_by_region ($region)\n\nReturns an arrayref of CIDRs matching the provided region.\n\n\n=cut\n\n=head2 get_cidrs_by_service ($service)\n\nReturns an arrayref of CIDRs matching the provided service (AMAZON|EC2|CLOUDFRONT|ROUTE53|ROUTE53_HEALTHCHECKS).\n\n\n=cut\n\n=head2 get_regions\n\nReturns an arrayref of the regions in the AWS IP address data.\n\n\n=cut\n\n=head2 get_services\n\nReturns an arrayref of the services (Amazon, EC2 etc) in the AWS IP address data.\n\n\n=cut\n\n=head2 SEE ALSO\n\nL\u003cAWS::Networks\u003e - is similar to this module but does not provide cacheing.\n\nAmazon's L\u003cpage|http://docs.aws.amazon.com/general/latest/gr/aws-ip-ranges.html\u003e on AWS IP ranges.\n\n\n=cut\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdnmfarrell%2Faws-ip","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdnmfarrell%2Faws-ip","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdnmfarrell%2Faws-ip/lists"}