모든 Amazon RDS 보안 그룹에 대한 정보 가져오기 - AWS 루비용 SDK

기계 번역으로 제공되는 번역입니다. 제공된 번역과 원본 영어의 내용이 상충하는 경우에는 영어 버전이 우선합니다.

모든 Amazon RDS 보안 그룹에 대한 정보 가져오기

다음 예제에서는 us-west-2 리전에 있는 모든 Amazon RDS 보안 그룹의 이름을 나열합니다.

참고

Amazon RDS 보안 그룹은 Amazon EC2-Classic 플랫폼을 사용하는 경우에만 적용할 수 있습니다. Amazon EC2–VPC를 사용하는 경우에는 VPC 보안 그룹을 사용하세요. 예제에 두 가지 모두 표시됩니다.

주의

EC2-Classic은 2022년 8월 15일에 사용 중지될 예정입니다. EC2-Classic에서 VPC로 마이그레이션하는 것이 좋습니다. 자세한 내용은 Linux 인스턴스용 Amazon EC2 사용 설명서 또는 Windows 인스턴스용 Amazon EC2 사용 설명서EC2-Classic에서 VPC로 마이그레이션을 참조하세요. 또는 블로그 게시물EC2-Classic 네트워킹은 사용 중지 중입니다 - 준비 방법은 다음과 같습니다를 참조하세요.

# Copyright 2010-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. # # This file is licensed under the Apache License, Version 2.0 (the "License"). # You may not use this file except in compliance with the License. A copy of the # License is located at # # http://aws.amazon.com/apache2.0/ # # This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS # OF ANY KIND, either express or implied. See the License for the specific # language governing permissions and limitations under the License. require 'aws-sdk-rds' # v2: require 'aws-sdk' rds = Aws::RDS::Resource.new(region: 'us-west-2') rds.db_instances.each do |i| # Show any security group IDs and descriptions puts 'Security Groups:' i.db_security_groups.each do |sg| puts sg.db_security_group_name puts ' ' + sg.db_security_group_description puts end # Show any VPC security group IDs and their status puts 'VPC Security Groups:' i.vpc_security_groups.each do |vsg| puts vsg.vpc_security_group_id puts ' ' + vsg.status puts end end