AWS announces preview of AWS Interconnect - multicloud
AWS announces AWS Interconnect – multicloud (preview), providing simple, resilient, high-speed private connections to other cloud service providers. AWS Interconnect - multicloud is easy to configure and provides high-speed, resilient connectivity with dedicated bandwidth, enabling customers to interconnect AWS networking services such as AWS Transit Gateway, AWS Cloud WAN, and Amazon VPC to other cloud service providers with ease.
Amazon VPC 퍼블릭 IPv4 주소 사용량을 식별, 모니터링 및 최적화하려면 어떻게 해야 합니까?
Amazon Virtual Private Cloud(Amazon VPC) IPv4 주소 사용량을 식별, 모니터링 및 최적화하려고 합니다.
해결 방법
참고: AWS Command Line Interface(AWS CLI) 명령을 실행할 때 오류가 발생하면 AWS CLI의 오류 해결을 참조하십시오. 또한 최신 AWS CLI 버전을 사용하고 있는지 확인하십시오.
모든 퍼블릭 IPv4 주소는 서비스 연결 여부에 관계없이 IP 주소마다 시간당 0.005 USD의 요금이 부과됩니다. Amazon Elastic Compute Cloud(Amazon EC2)의 AWS 프리 티어 고객인 경우 750시간의 무료 사용 혜택을 받습니다. 이 무료 사용은 퍼블릭 IPv4 주소로 Amazon EC2 인스턴스를 시작할 때 지원됩니다.
Public IP Insights 활성화
Public IP Insights를 사용하여 서비스가 현재 AWS 리전에서 사용하는 퍼블릭 IPv4 주소를 모니터링, 분석 및 감사할 수 있습니다.
Public IP Insights를 활성화하려면 Amazon VPC IP Address Manager(IPAM) 풀을 생성하십시오. 퍼블릭 IPv4 주소 사용량을 식별하려면 IPAM Public IP Insights를 단일 AWS 계정 또는 AWS Organizations 계정과 통합하십시오.
참고: 프리 티어에서는 Public IP Insights를 무료로 이용할 수 있습니다. 어드밴스드 티어 요금 정보는 Amazon VPC 요금 페이지의 IPAM 탭을 참조하십시오. IPAM을 Organizations와 통합하면 프리 티어에서도 조직의 모든 리전 및 계정에 Public IP Insights를 사용할 수 있습니다.
결과를 보려면 Amazon VPC 콘솔 또는 AWS CLI를 사용하면 됩니다.
참고: IPAM 풀을 생성하면 Public IP Insights가 퍼블릭 IPv4 주소에 대한 보고서를 생성합니다. 보고서를 생성하는 데 필요한 시간은 조직의 규모에 따라 다릅니다.
Cost and Usage Report 활성화
AWS Cost and Usage Report(CUR)에는 사용 중인 퍼블릭 IPv4 주소와 미사용 퍼블릭 IPv4 주소 모두의 사용량 데이터가 포함됩니다. CUR을 생성할 때 리소스 ID 포함을 선택하면 리소스 수준의 자세한 분석 결과를 얻을 수 있습니다. CUR을 생성하면 하루에 한 번 이상 AWS에서 보고서 파일을 업데이트하며, 이 보고서 파일에는 해당 월의 데이터가 포함됩니다. 보고서 파일을 사용하여 과거의 IPv4 주소 사용량 데이터를 분석할 수 있습니다.
참고: Amazon Simple Storage Service(Amazon S3) 버킷에서 보고서에 액세스할 수 있습니다. AWS가 Amazon S3 버킷에 보고서를 전송하는 데는 최대 24시간이 걸릴 수 있습니다.
퍼블릭 IPv4 주소를 즉시 식별
참고: 퍼블릭 IPv4 주소 사용량에 대한 계획된 분석에는 CUR과 Public IP Insights를 사용하는 것이 좋습니다.
퍼블릭 IPv4 주소를 사용하는 서비스를 즉시 식별하려면 Amazon EC2 콘솔 또는 AWS CLI를 사용하십시오.
Amazon EC2 콘솔
네트워크 인터페이스를 분석하여 퍼블릭 IPv4 주소를 사용하는 서비스를 확인하려면 다음 단계를 완료하십시오.
- Amazon EC2 콘솔을 엽니다.
- 탐색 창의 네트워크 및 보안 아래에서 네트워크 인터페이스를 선택합니다.
- 퍼블릭 IPv4 주소 필터에서 **<*>**를 입력하여 기본 퍼블릭 IPv4 주소를 사용하는 탄력적 네트워크 인터페이스를 식별합니다.
- 네트워크 인터페이스 설명 및 인터페이스 유형을 사용하여 퍼블릭 IPv4 주소를 사용하는 서비스를 식별합니다.
- 리전에 네트워크 인터페이스가 있는 모든 퍼블릭 및 보조 IP 주소를 표시하려면 다음 명령을 실행합니다.
참고: example-region을 해당 리전으로 바꾸십시오.aws ec2 describe-network-interfaces --region example-region --query 'NetworkInterfaces[*].PrivateIpAddresses[?Association.PublicIp].Association.PublicIp[]' --output table
AWS Site-to-Site VPN에서 사용하는 퍼블릭 IPv4 주소에 대해서는 VPN 터널의 현재 상태를 확인하려면 어떻게 해야 합니까?를 참조하십시오.
표준 및 사용자 지정 AWS Global Accelerator에서 사용하는 퍼블릭 IPv4 주소에 대해서는 액셀러레이터 보기를 참조하십시오.
유휴 또는 연결된 탄력적 IP 주소를 보려면 다음 단계를 완료하십시오.
- Amazon EC2 콘솔을 엽니다.
- 탐색 창의 네트워크 및 보안 아래에서 탄력적 IP를 선택합니다.
- 탄력적 IP 주소를 선택하면 해당 탄력적 IP 주소를 사용하는 리소스를 볼 수 있습니다.
참고: 사용량에 대한 자세한 내용은 네트워크 인터페이스 또는 인스턴스 필드를 확인하십시오.
기존 보유 IP 주소 사용(BYOIP)의 경우에는 요금이 부과되지 않습니다. AWS는 us-west-2 리전의 Global Accelerator에게 요금을 청구합니다.
AWS CLI
사전 요구 사항: aws configure AWS CLI 명령을 실행하여 자격 증명을 설정합니다. 또한 Boto3를 설치합니다. 자세한 내용은 Boto3 웹 사이트에서 Install Boto3을 참조하십시오.
퍼블릭 IPv4 주소를 사용하는 서비스를 즉시 식별하려면 AWS CloudShell 또는 Linux 환경에서 다음 단계를 완료하십시오.
-
다음 파일을 생성합니다.
touch public_ipv4_recon.py -
다음 명령을 실행하여 파일을 편집합니다.
vim public_ipv4_recon.py -
다음 코드를 복사하여 파일에 붙여넣은 다음, 파일을 저장합니다.
#!/usr/bin/env python3 import pprint import boto3, sys profile = boto3.Session(profile_name=sys.argv[1]) aga = profile.client('globalaccelerator', region_name='us-west-2') ec2 = boto3.client('ec2') def global_public_ipv4_lookup(aga): try: # global accelerator next_token = None while True: if next_token: resource = aga.list_accelerators( NextToken = next_token ) else: resource = aga.list_accelerators( ) print('Describing world wide Global Accelerators...') print('Note: AWS Global Accelerators are billed in us-west-2....') print(f'Number of AGA: {len(resource["Accelerators"])}') print('-'*40) for item in resource["Accelerators"]: print(f'Name: {item["Name"]}') if 'IpSets' in item.keys(): for ip in item["IpSets"][0]["IpAddresses"]: print(f'Public IPv4: {ip}') print(f'Status: {item["Status"]}') print() next_token = resource.get("NextToken") if next_token is None: break print() # custom_routing_accelerators next_token = None while True: if next_token: custom_routing = aga.list_custom_routing_accelerators( NextToken = next_token ) else: custom_routing = aga.list_custom_routing_accelerators( ) print('Describing world wide Custom Routing Accelerators...') print('Note: AWS Global Accelerators are billed in us-west-2....') print(f'Number of custom AGA: {len(custom_routing["Accelerators"])}') print('-'*40) for item in custom_routing["Accelerators"]: if 'IpSets' in item.keys(): for ip in item["IpSets"][0]["IpAddresses"]: print(f'Public IPv4: {ip}') print(f'Status: {item["Status"]}') print() next_token = custom_routing.get("NextToken") if next_token is None: break print() except Exception as err: print(f'Error found: {err}...') pass def public_ipv4_lookup(ec2): try: # vpn next_token = None while True: if next_token: vpn = ec2.describe_vpn_connections( NextToken = next_token ) else: vpn = ec2.describe_vpn_connections( ) print('Describing VPNs...') print(f'Number of Vpn connections: {len(vpn["VpnConnections"])}') print('-'*40) for item in vpn["VpnConnections"]: if 'VpnConnectionId' in item.keys(): print(f'Vpn Id: {item["VpnConnectionId"]}') for ip in item["VgwTelemetry"]: print(f'Public ipv4: {ip["OutsideIpAddress"]}') print() next_token = vpn.get("NextToken") if next_token is None: break print() # elastic ip eip = ec2.describe_addresses( ) print('Describing Elastic IPs...') print(f'Number of Elastic Ips: {len(eip["Addresses"])}') print('-'*40) for item in eip["Addresses"]: if 'AllocationId' in item.keys(): print(f'Eip Id: {item["AllocationId"]}') print(f'Public ipv4: {item["PublicIp"]}') print() print() # network interfaces next_token = None while True: if next_token: interface = ec2.describe_network_interfaces( NextToken=next_token ) else: interface = ec2.describe_network_interfaces( ) print('Describing Network Interfaces...') print(f'Number of interfaces: {len(interface["NetworkInterfaces"])}') print('Only printing Interfaces with a public IPv4 address...') print('-'*40) for item in interface["NetworkInterfaces"]: for ip in item["PrivateIpAddresses"]: if 'Association' not in ip.keys(): pass else: print(f'Interface Id: {item["NetworkInterfaceId"]}') print(f'Description: {item["Description"]}') print(f'Status: {interface["NetworkInterfaces"][0]["Status"]}') print(f'Public Ip: {ip["Association"]["PublicIp"]}\n') next_token = interface.get("NextToken") if next_token is None: break except Exception as err: print(f'Error found: {err}...') pass # Run code if len(sys.argv) < 3 or not sys.argv[2]: global_public_ipv4_lookup(aga) regions_list = ec2.describe_regions( AllRegions=False ) for region in regions_list['Regions']: if region["OptInStatus"] == 'opted-in' or 'opt-in-not-required': print(f'\n**********-[{region["RegionName"]}]-**********\n') public_ipv4_lookup( ec2=profile.client('ec2', region_name=region["RegionName"]) ) elif sys.argv[2]: global_public_ipv4_lookup(aga) public_ipv4_lookup( ec2=profile.client('ec2', region_name=sys.argv[2]) ) -
모든 리전을 확인하려면 다음 명령을 실행합니다.
python3 public_ipv4_recon.py example-cli-profile참고: example-cli-profile을 구성된 AWS CLI 프로파일의 이름 또는 .aws/credentials 파일에 정의된 프로파일 이름으로 바꾸십시오. Windows를 사용하는 경우 python3을 python으로 바꾸십시오.
-또는-
특정 리전을 확인하려면 다음 명령을 실행합니다.python3 public_ipv4_recon.py example-cli-profile example-region참고: example-cli-profile을 구성된 AWS CLI 프로파일의 이름 또는 .aws/credentials 파일에 정의된 프로파일 이름으로 바꾸십시오. example-region을 해당 리전으로 바꾸십시오.
요청을 실행할 권한이 없거나 해당 계정에 리전이 비활성화된 경우 다음과 같은 오류가 나타날 수 있습니다.
"Error found: An error occurred (AuthFailure) when calling the <API> operation: AWS was not able to validate the provided access credentials..."
퍼블릭 IPv4 주소 사용량 최적화 및 IPv6 주소 채택
비용을 최적화하려면 현재 아키텍처를 개선하여 퍼블릭 IPv4 주소 사용을 최소화하십시오. 또한 ](https://docs.aws.amazon.com/vpc/latest/userguide/ipv4-ipv6-comparison.html)IPv6으로 마이그레이션[하는 것이 좋습니다. IPv6 주소에는 요금이 부과되지 않습니다.
- 언어
- 한국어
