AWS CLI를 사용한 VPC Lattice 예시
다음 코드 예시는 VPC Lattice와 함께 AWS Command Line Interface를 사용하여 작업을 수행하고 일반적인 시나리오를 구현하는 방법을 보여줍니다.
작업은 대규모 프로그램에서 발췌한 코드이며 컨텍스트에 맞춰 실행해야 합니다. 작업은 관련 시나리오의 컨텍스트에 따라 표시되며, 개별 서비스 함수를 직접적으로 호출하는 방법을 보여줍니다.
각 예시에는 전체 소스 코드에 대한 링크가 포함되어 있으며, 여기에서 컨텍스트에 맞춰 코드를 설정하고 실행하는 방법에 대한 지침을 찾을 수 있습니다.
주제
작업
다음 코드 예시에서는 create-listener
의 사용 방법을 보여줍니다.
- AWS CLI
-
리스너 생성
다음
create-listener
예시에서는 트래픽을 지정된 VPC Lattice 대상 그룹에 전달하는 기본 규칙을 사용하여 HTTPS 리스너를 생성합니다.aws vpc-lattice create-listener \ --name
my-service-listener
\ --protocolHTTPS
\ --port443
\ --service-identifiersvc-0285b53b2eEXAMPLE
\ --default-actionfile://listener-config.json
listener-config.json
의 콘텐츠:{ "forward": { "targetGroups": [ { "targetGroupIdentifier": "tg-0eaa4b9ab4EXAMPLE" } ] } }
출력:
{ "arn": "arn:aws:vpc-lattice:us-east-2:123456789012:service/svc-0285b53b2eEXAMPLE/listener/listener-07cc7fb0abEXAMPLE", "defaultAction": { "forward": { "targetGroups": [ { "targetGroupIdentifier": "tg-0eaa4b9ab4EXAMPLE", "weight": 100 } ] } }, "id": "listener-07cc7fb0abEXAMPLE", "name": "my-service-listener", "port": 443, "protocol": "HTTPS", "serviceArn": "arn:aws:vpc-lattice:us-east-2:123456789012:service/svc-0285b53b2eEXAMPLE", "serviceId": "svc-0285b53b2eEXAMPLE" }
자세한 내용은 Amazon VPC Lattice 사용자 안내서의 리스너를 참조하세요.
-
API 세부 정보는 AWS CLI 명령 참조의 CreateListener
를 참조하세요.
-
다음 코드 예시에서는 create-service-network-service-association
의 사용 방법을 보여줍니다.
- AWS CLI
-
서비스 연결 생성
다음
create-service-network-service-association
예시에서는 지정된 서비스를 지정된 서비스 네트워크에 연결합니다.aws vpc-lattice create-service-network-service-association \ --service-identifier
svc-0285b53b2eEXAMPLE
\ --service-network-identifiersn-080ec7dc93EXAMPLE
출력:
{ "arn": "arn:aws:vpc-lattice:us-east-2:123456789012:servicenetworkserviceassociation/snsa-0e16955a8cEXAMPLE", "createdBy": "123456789012", "dnsEntry": { "domainName": "my-lattice-service-0285b53b2eEXAMPLE.7d67968.vpc-lattice-svcs.us-east-2.on.aws", "hostedZoneId": "Z09127221KTH2CEXAMPLE" }, "id": "snsa-0e16955a8cEXAMPLE", "status": "CREATE_IN_PROGRESS" }
자세한 내용은 Amazon VPC Lattice 사용자 안내서의 서비스 연결 관리를 참조하세요.
-
API 세부 정보는 AWS CLI 명령 참조의 CreateServiceNetworkServiceAssociation
을 참조하세요.
-
다음 코드 예시에서는 create-service-network-vpc-association
의 사용 방법을 보여줍니다.
- AWS CLI
-
VPC 연결 생성
다음
create-service-network-vpc-association
예시에서는 지정된 VPC를 지정된 서비스 네트워크에 연결합니다. 지정된 보안 그룹은 서비스 네트워크 및 해당 서비스에 액세스할 수 있는 VPC의 리소스를 제어합니다.aws vpc-lattice create-service-network-vpc-association \ --vpc-identifier
vpc-0a1b2c3d4eEXAMPLE
\ --service-network-identifiersn-080ec7dc93EXAMPLE
\ --security-group-idssg-0aee16bc6cEXAMPLE
출력:
{ "arn": "arn:aws:vpc-lattice:us-east-2:123456789012:servicenetworkvpcassociation/snva-0821fc8631EXAMPLE", "createdBy": "123456789012", "id": "snva-0821fc8631EXAMPLE", "securityGroupIds": [ "sg-0aee16bc6cEXAMPLE" ], "status": "CREATE_IN_PROGRESS" }
자세한 내용은 Amazon VPC Lattice 사용자 안내서의 VPC 연결 관리를 참조하세요.
-
API 세부 정보는 AWS CLI 명령 참조의 CreateServiceNetworkVpcAssociation
을 참조하세요.
-
다음 코드 예시에서는 create-service-network
의 사용 방법을 보여줍니다.
- AWS CLI
-
서비스 네트워크 생성
다음
create-service-network
예시에서는 지정된 이름을 사용하여 서비스 네트워크를 생성합니다.aws vpc-lattice create-service-network \ --name
my-service-network
출력:
{ "arn": "arn:aws:vpc-lattice:us-east-2:123456789012:servicenetwork/sn-080ec7dc93EXAMPLE", "authType": "NONE", "id": "sn-080ec7dc93EXAMPLE", "name": "my-service-network" }
자세한 내용은 Amazon VPC Lattice 사용자 안내서의 서비스 네트워크를 참조하세요.
-
API 세부 정보는 AWS CLI 명령 참조의 CreateServiceNetwork
를 참조하세요.
-
다음 코드 예시에서는 create-service
의 사용 방법을 보여줍니다.
- AWS CLI
-
서비스 생성
다음
create-service
예시에서는 지정된 이름을 사용하여 서비스를 생성합니다.aws vpc-lattice create-service \ --name
my-lattice-service
출력:
{ "arn": "arn:aws:vpc-lattice:us-east-2:123456789012:service/svc-0285b53b2eEXAMPLE", "authType": "NONE", "dnsEntry": { "domainName": "my-lattice-service-0285b53b2eEXAMPLE.1a2b3c4.vpc-lattice-svcs.us-east-2.on.aws", "hostedZoneId": "Z09127221KTH2CEXAMPLE" }, "id": "svc-0285b53b2eEXAMPLE", "name": "my-lattice-service", "status": "CREATE_IN_PROGRESS" }
자세한 내용은 Amazon VPC Lattice 사용자 안내서의 VPC Lattice 서비스를 참조하세요.
-
API 세부 정보는 AWS CLI 명령 참조의 CreateService
를 참조하세요.
-
다음 코드 예시에서는 create-target-group
의 사용 방법을 보여줍니다.
- AWS CLI
-
예시 1: INSTANCE 유형의 대상 그룹 생성
다음
create-target-group
예시에서는 지정된 이름, 유형 및 구성을 사용하여 대상 그룹을 생성합니다.aws vpc-lattice create-target-group \ --name
my-lattice-target-group-instance
\ --typeINSTANCE
\ --configfile://tg-config.json
tg-config.json
의 콘텐츠:{ "port": 443, "protocol": "HTTPS", "protocolVersion": "HTTP1", "vpcIdentifier": "vpc-f1663d9868EXAMPLE" }
출력:
{ "arn": "arn:aws:vpc-lattice:us-east-2:123456789012:targetgroup/tg-0eaa4b9ab4EXAMPLE", "config": { "healthCheck": { "enabled": true, "healthCheckIntervalSeconds": 30, "healthCheckTimeoutSeconds": 5, "healthyThresholdCount": 5, "matcher": { "httpCode": "200" }, "path": "/", "protocol": "HTTPS", "protocolVersion": "HTTP1", "unhealthyThresholdCount": 2 }, "port": 443, "protocol": "HTTPS", "protocolVersion": "HTTP1", "vpcIdentifier": "vpc-f1663d9868EXAMPLE" }, "id": "tg-0eaa4b9ab4EXAMPLE", "name": "my-lattice-target-group-instance", "status": "CREATE_IN_PROGRESS", "type": "INSTANCE" }
예시 2: IP 유형의 대상 그룹 생성
다음
create-target-group
예시에서는 지정된 이름, 유형 및 구성을 사용하여 대상 그룹을 생성합니다.aws vpc-lattice create-target-group \ --name
my-lattice-target-group-ip
\ --typeIP
\ --configfile://tg-config.json
tg-config.json
의 콘텐츠:{ "ipAddressType": "IPV4", "port": 443, "protocol": "HTTPS", "protocolVersion": "HTTP1", "vpcIdentifier": "vpc-f1663d9868EXAMPLE" }
출력:
{ "arn": "arn:aws:vpc-lattice:us-east-2:123456789012:targetgroup/tg-0eaa4b9ab4EXAMPLE", "config": { "healthCheck": { "enabled": true, "healthCheckIntervalSeconds": 30, "healthCheckTimeoutSeconds": 5, "healthyThresholdCount": 5, "matcher": { "httpCode": "200" }, "path": "/", "protocol": "HTTPS", "protocolVersion": "HTTP1", "unhealthyThresholdCount": 2 }, "ipAddressType": "IPV4", "port": 443, "protocol": "HTTPS", "protocolVersion": "HTTP1", "vpcIdentifier": "vpc-f1663d9868EXAMPLE" }, "id": "tg-0eaa4b9ab4EXAMPLE", "name": "my-lattice-target-group-ip", "status": "CREATE_IN_PROGRESS", "type": "IP" }
예시 3: LAMBDA 유형의 대상 그룹 생성
다음
create-target-group
예시에서는 지정된 이름, 유형 및 구성을 사용하여 대상 그룹을 생성합니다.aws vpc-lattice create-target-group \ --name
my-lattice-target-group-lambda
\ --typeLAMBDA
출력:
{ "arn": "arn:aws:vpc-lattice:us-east-2:123456789012:targetgroup/tg-0eaa4b9ab4EXAMPLE", "id": "tg-0eaa4b9ab4EXAMPLE", "name": "my-lattice-target-group-lambda", "status": "CREATE_IN_PROGRESS", "type": "LAMBDA" }
예시 4: ALB 유형의 대상 그룹 생성
다음
create-target-group
예시에서는 지정된 이름, 유형 및 구성을 사용하여 대상 그룹을 생성합니다.aws vpc-lattice create-target-group \ --name
my-lattice-target-group-alb
\ --typeALB
\ --configfile://tg-config.json
tg-config.json
의 콘텐츠:{ "port": 443, "protocol": "HTTPS", "protocolVersion": "HTTP1", "vpcIdentifier": "vpc-f1663d9868EXAMPLE" }
출력:
{ "arn": "arn:aws:vpc-lattice:us-east-2:123456789012:targetgroup/tg-0eaa4b9ab4EXAMPLE", "config": { "port": 443, "protocol": "HTTPS", "protocolVersion": "HTTP1", "vpcIdentifier": "vpc-f1663d9868EXAMPLE" }, "id": "tg-0eaa4b9ab4EXAMPLE", "name": "my-lattice-target-group-alb", "status": "CREATE_IN_PROGRESS", "type": "ALB" }
자세한 내용은 Amazon VPC Lattice 사용자 안내서의 대상 그룹을 참조하세요.
-
API 세부 정보는 AWS CLI 명령 참조의 CreateTargetGroup
을 참조하세요.
-
다음 코드 예시에서는 delete-auth-policy
의 사용 방법을 보여줍니다.
- AWS CLI
-
인증 정책 삭제
다음
delete-auth-policy
예시에서는 지정된 서비스의 인증 정책을 삭제합니다.aws vpc-lattice delete-auth-policy \ --resource-identifier
svc-0285b53b2eEXAMPLE
이 명령은 출력을 생성하지 않습니다.
자세한 내용은 Amazon VPC Lattice 사용자 안내서의 인증 정책을 참조하세요.
-
API 세부 정보는 AWS CLI 명령 참조의 DeleteAuthPolicy
를 참조하세요.
-
다음 코드 예시에서는 delete-listener
의 사용 방법을 보여줍니다.
- AWS CLI
-
리스너를 삭제하려면
다음
delete-listener
예시에서는 지정된 리스너를 삭제합니다.aws vpc-lattice delete-listener \ --listener-identifier
listener-07cc7fb0abEXAMPLE
\ --service-identifiersvc-0285b53b2eEXAMPLE
이 명령은 출력을 생성하지 않습니다.
자세한 내용은 Amazon VPC Lattice 사용자 안내서의 리스너를 참조하세요.
-
API 세부 정보는 AWS CLI 명령 참조의 DeleteListener
를 참조하세요.
-
다음 코드 예시에서는 delete-service-network-service-association
의 사용 방법을 보여줍니다.
- AWS CLI
-
서비스 연결 삭제
다음
delete-service-network-service-association
예시에서는 지정된 서비스 연결을 해제합니다.aws vpc-lattice delete-service-network-service-association \ --service-network-service-association-identifier
snsa-031fabb4d8EXAMPLE
출력:
{ "arn": "arn:aws:vpc-lattice:us-east-2:123456789012:servicenetworkserviceassociation/snsa-031fabb4d8EXAMPLE", "id": "snsa-031fabb4d8EXAMPLE", "status": "DELETE_IN_PROGRESS" }
자세한 내용은 Amazon VPC Lattice 사용자 안내서의 서비스 연결 관리를 참조하세요.
-
API 세부 정보는 AWS CLI 명령 참조의 DeleteServiceNetworkServiceAssociation
을 참조하세요.
-
다음 코드 예시에서는 delete-service-network-vpc-association
의 사용 방법을 보여줍니다.
- AWS CLI
-
VPC 연결 삭제
다음
delete-service-network-vpc-association
예시에서는 지정된 VPC 연결을 해제합니다.aws vpc-lattice delete-service-network-vpc-association \ --service-network-vpc-association-identifier
snva-0821fc8631EXAMPLE
출력:
{ "arn": "arn:aws:vpc-lattice:us-east-2:123456789012:servicenetworkvpcassociation/snva-0821fc8631EXAMPLE", "id": "snva-0821fc8631EXAMPLE", "status": "DELETE_IN_PROGRESS" }
자세한 내용은 Amazon VPC Lattice 사용자 안내서의 VPC 연결 관리를 참조하세요.
-
API 세부 정보는 AWS CLI 명령 참조의 DeleteServiceNetworkVpcAssociation
을 참조하세요.
-
다음 코드 예시에서는 delete-service-network
의 사용 방법을 보여줍니다.
- AWS CLI
-
서비스 네트워크 삭제
다음
delete-service-network
예시에서는 지정된 서비스 네트워크를 삭제합니다.aws vpc-lattice delete-service-network \ --service-network-identifier
sn-080ec7dc93EXAMPLE
이 명령은 출력을 생성하지 않습니다.
자세한 내용은 Amazon VPC Lattice 사용자 안내서의 서비스 네트워크를 참조하세요.
-
API 세부 정보는 AWS CLI 명령 참조의 DeleteServiceNetwork
를 참조하세요.
-
다음 코드 예시에서는 delete-service
의 사용 방법을 보여줍니다.
- AWS CLI
-
서비스 삭제
다음
delete-service
예시에서는 지정된 서비스를 삭제합니다.aws vpc-lattice delete-service \ --service-identifier
svc-0285b53b2eEXAMPLE
출력:
{ "arn": "arn:aws:vpc-lattice:us-west-2:123456789012:service/svc-0285b53b2eEXAMPLE", "id": "svc-0285b53b2eEXAMPLE", "name": "my-lattice-service", "status": "DELETE_IN_PROGRESS" }
자세한 내용은 Amazon VPC Lattice 사용자 안내서의 VPC Lattice 서비스를 참조하세요.
-
API 세부 정보는 AWS CLI 명령 참조의 DeleteService
를 참조하세요.
-
다음 코드 예시에서는 delete-target-group
의 사용 방법을 보여줍니다.
- AWS CLI
-
대상 그룹 삭제
다음
delete-target-group
예시에서는 지정된 대상 그룹을 삭제합니다.aws vpc-lattice delete-target-group \ --target-group-identifier
tg-0eaa4b9ab4EXAMPLE
출력:
{ "arn": "arn:aws:vpc-lattice:us-east-2:123456789012:targetgroup/tg-0eaa4b9ab4EXAMPLE", "id": "tg-0eaa4b9ab4EXAMPLE", "status": "DELETE_IN_PROGRESS" }
자세한 내용은 Amazon VPC Lattice 사용자 안내서의 대상 그룹을 참조하세요.
-
API 세부 정보는 AWS CLI 명령 참조의 DeleteTargetGroup
을 참조하세요.
-
다음 코드 예시에서는 deregister-targets
의 사용 방법을 보여줍니다.
- AWS CLI
-
대상 등록 취소
다음
deregister-targets
예시에서는 지정된 대상 그룹에서 지정된 대상을 등록 취소합니다.aws vpc-lattice deregister-targets \ --targets
i-07dd579bc5EXAMPLE
\ --target-group-identifiertg-0eaa4b9ab4EXAMPLE
출력:
{ "successful": [ { "id": "i-07dd579bc5EXAMPLE", "port": 443 } ], "unsuccessful": [] }
자세한 내용은 Amazon VPC Lattice 사용자 안내서의 대상 등록을 참조하세요.
-
API 세부 정보는 AWS CLI 명령 참조의 DeregisterTargets
를 참조하세요.
-
다음 코드 예시에서는 get-auth-policy
의 사용 방법을 보여줍니다.
- AWS CLI
-
인증 정책 정보 가져오기
다음
get-auth-policy
예시에서는 지정된 서비스의 인증 정책에 대한 정보를 가져옵니다.aws vpc-lattice get-auth-policy \ --resource-identifier
svc-0285b53b2eEXAMPLE
출력:
{ "createdAt": "2023-06-07T03:51:20.266Z", "lastUpdatedAt": "2023-06-07T04:39:27.082Z", "policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Effect\":\"Allow\",\"Principal\":{\"AWS\":\"arn:aws:iam::123456789012:role/my-clients\"},\"Action\":\"vpc-lattice-svcs:Invoke\",\"Resource\":\"arn:aws:vpc-lattice:us-east-2:123456789012:service/svc-0285b53b2eEXAMPLE\"}]}", "state": "Active" }
자세한 내용은 Amazon VPC Lattice 사용자 안내서의 인증 정책을 참조하세요.
-
API 세부 정보는 AWS CLI 명령 참조의 GetAuthPolicy
를 참조하세요.
-
다음 코드 예시에서는 get-listener
의 사용 방법을 보여줍니다.
- AWS CLI
-
서비스 리스너 정보 가져오기
다음
get-listener
예시에서는 지정된 서비스의 지정된 리스너에 대한 정보를 가져옵니다.aws vpc-lattice get-listener \ --listener-identifier
listener-0ccf55918cEXAMPLE
\ --service-identifiersvc-0285b53b2eEXAMPLE
출력:
{ "arn": "arn:aws:vpc-lattice:us-east-2:123456789012:service/svc-0285b53b2eEXAMPLE/listener/listener-0ccf55918cEXAMPLE", "createdAt": "2023-05-07T05:08:45.192Z", "defaultAction": { "forward": { "targetGroups": [ { "targetGroupIdentifier": "tg-0ff213abb6EXAMPLE", "weight": 1 } ] } }, "id": "listener-0ccf55918cEXAMPLE", "lastUpdatedAt": "2023-05-07T05:08:45.192Z", "name": "http-80", "port": 80, "protocol": "HTTP", "serviceArn": "arn:aws:vpc-lattice:us-east-2:123456789012:service/svc-0285b53b2eEXAMPLE", "serviceId": "svc-0285b53b2eEXAMPLE" }
자세한 내용은 Amazon VPC Lattice 사용자 안내서의 라우팅 정의를 참조하세요.
-
API 세부 정보는 AWS CLI 명령 참조의 GetListener
를 참조하세요.
-
다음 코드 예시에서는 get-service-network-service-association
의 사용 방법을 보여줍니다.
- AWS CLI
-
서비스 연결 정보 가져오기
다음
get-service-network-service-association
예시에서는 지정된 서비스 연결의 정보를 가져옵니다.aws vpc-lattice get-service-network-service-association \ --service-network-service-association-identifier
snsa-031fabb4d8EXAMPLE
출력:
{ "arn": "arn:aws:vpc-lattice:us-east-2:123456789012:servicenetworkserviceassociation/snsa-031fabb4d8EXAMPLE", "createdAt": "2023-05-05T21:48:16.076Z", "createdBy": "123456789012", "dnsEntry": { "domainName": "my-lattice-service-0285b53b2eEXAMPLE.7d67968.vpc-lattice-svcs.us-east-2.on.aws", "hostedZoneId": "Z09127221KTH2CEXAMPLE" }, "id": "snsa-031fabb4d8EXAMPLE", "serviceArn": "arn:aws:vpc-lattice:us-east-2:123456789012:service/svc-0285b53b2eEXAMPLE", "serviceId": "svc-0285b53b2eEXAMPLE", "serviceName": "my-lattice-service", "serviceNetworkArn": "arn:aws:vpc-lattice:us-east-2:123456789012:servicenetwork/sn-080ec7dc93EXAMPLE", "serviceNetworkId": "sn-080ec7dc93EXAMPLE", "serviceNetworkName": "my-service-network", "status": "ACTIVE" }
자세한 내용은 Amazon VPC Lattice 사용자 안내서의 서비스 연결 관리를 참조하세요.
-
API 세부 정보는 AWS CLI 명령 참조의 GetServiceNetworkServiceAssociation
을 참조하세요.
-
다음 코드 예시에서는 get-service-network-vpc-association
의 사용 방법을 보여줍니다.
- AWS CLI
-
VPC 연결 정보 가져오기
다음
get-service-network-vpc-association
예시에서는 지정된 VPC 연결의 정보를 가져옵니다.aws vpc-lattice get-service-network-vpc-association \ --service-network-vpc-association-identifier
snva-0821fc8631EXAMPLE
출력:
{ "arn": "arn:aws:vpc-lattice:us-east-2:123456789012:servicenetworkvpcassociation/snva-0821fc8631EXAMPLE", "createdAt": "2023-06-06T23:41:08.421Z", "createdBy": "123456789012", "id": "snva-0c5dcb60d6EXAMPLE", "lastUpdatedAt": "2023-06-06T23:41:08.421Z", "securityGroupIds": [ "sg-0aee16bc6cEXAMPLE" ], "serviceNetworkArn": "arn:aws:vpc-lattice:us-east-2:123456789012:servicenetwork/sn-080ec7dc93EXAMPLE", "serviceNetworkId": "sn-080ec7dc93EXAMPLE", "serviceNetworkName": "my-service-network", "status": "ACTIVE", "vpcId": "vpc-0a1b2c3d4eEXAMPLE" }
자세한 내용은 Amazon VPC Lattice 사용자 안내서의 VPC 연결 관리를 참조하세요.
-
API 세부 정보는 AWS CLI 명령 참조의 GetServiceNetworkVpcAssociation
을 참조하세요.
-
다음 코드 예시에서는 get-service-network
의 사용 방법을 보여줍니다.
- AWS CLI
-
서비스 네트워크 정보 가져오기
다음
get-service-network
예시에서는 지정된 서비스 네트워크의 정보를 가져옵니다.aws vpc-lattice get-service-network \ --service-network-identifier
sn-080ec7dc93EXAMPLE
출력:
{ "arn": "arn:aws:vpc-lattice:us-east-2:123456789012:servicenetwork/sn-080ec7dc93EXAMPLE", "authType": "AWS_IAM", "createdAt": "2023-05-05T15:26:08.417Z", "id": "sn-080ec7dc93EXAMPLE", "lastUpdatedAt": "2023-05-05T15:26:08.417Z", "name": "my-service-network", "numberOfAssociatedServices": 2, "numberOfAssociatedVPCs": 3 }
자세한 내용은 Amazon VPC Lattice 사용자 안내서의 서비스 네트워크를 참조하세요.
-
API 세부 정보는 AWS CLI 명령 참조의 GetServiceNetwork
를 참조하세요.
-
다음 코드 예시에서는 get-service
의 사용 방법을 보여줍니다.
- AWS CLI
-
서비스 정보 가져오기
다음
get-service
예시에서는 지정된 서비스의 정보를 가져옵니다.aws vpc-lattice get-service \ --service-identifier
svc-0285b53b2eEXAMPLE
출력:
{ "arn": "arn:aws:vpc-lattice:us-east-2:123456789012:service/svc-0285b53b2eEXAMPLE", "authType": "AWS_IAM", "createdAt": "2023-05-05T21:35:29.339Z", "dnsEntry": { "domainName": "my-lattice-service-0285b53b2eEXAMPLE.7d67968.vpc-lattice-svcs.us-east-2.on.aws", "hostedZoneId": "Z09127221KTH2CFUOHIZH" }, "id": "svc-0285b53b2eEXAMPLE", "lastUpdatedAt": "2023-05-05T21:35:29.339Z", "name": "my-lattice-service", "status": "ACTIVE" }
자세한 내용은 Amazon VPC Lattice 사용자 안내서의 서비스를 참조하세요.
-
API 세부 정보는 AWS CLI 명령 참조의 GetService
를 참조하세요.
-
다음 코드 예시에서는 get-target-group
의 사용 방법을 보여줍니다.
- AWS CLI
-
대상 그룹 정보 가져오기
다음
get-target-group
예시에서는 대상 유형이INSTANCE
인 지정된 대상 그룹의 정보를 가져옵니다.aws vpc-lattice get-target-group \ --target-group-identifier
tg-0eaa4b9ab4EXAMPLE
출력:
{ "arn": "arn:aws:vpc-lattice:us-east-2:123456789012:targetgroup/tg-0eaa4b9ab4EXAMPLE", "config": { "healthCheck": { "enabled": true, "healthCheckIntervalSeconds": 30, "healthCheckTimeoutSeconds": 5, "healthyThresholdCount": 5, "matcher": { "httpCode": "200" }, "path": "/", "protocol": "HTTPS", "protocolVersion": "HTTP1", "unhealthyThresholdCount": 2 }, "port": 443, "protocol": "HTTPS", "protocolVersion": "HTTP1", "vpcIdentifier": "vpc-f1663d9868EXAMPLE" }, "createdAt": "2023-05-06T04:41:04.122Z", "id": "tg-0eaa4b9ab4EXAMPLE", "lastUpdatedAt": "2023-05-06T04:41:04.122Z", "name": "my-target-group", "serviceArns": [ "arn:aws:vpc-lattice:us-east-2:123456789012:service/svc-0285b53b2eEXAMPLE" ], "status": "ACTIVE", "type": "INSTANCE" }
자세한 내용은 Amazon VPC Lattice 사용자 안내서의 대상 그룹을 참조하세요.
-
API 세부 정보는 AWS CLI 명령 참조의 GetTargetGroup
을 참조하세요.
-
다음 코드 예시에서는 list-listeners
의 사용 방법을 보여줍니다.
- AWS CLI
-
서비스 리스너 나열
다음
list-listeners
예시에서는 지정된 서비스의 리스너를 나열합니다.aws vpc-lattice list-listeners \ --service-identifier
svc-0285b53b2eEXAMPLE
출력:
{ "items": [ { "arn": "arn:aws:vpc-lattice:us-east-2:123456789012:service/svc-0285b53b2eEXAMPLE/listener/listener-0ccf55918cEXAMPLE", "createdAt": "2023-05-07T05:08:45.192Z", "id": "listener-0ccf55918cEXAMPLE", "lastUpdatedAt": "2023-05-07T05:08:45.192Z", "name": "http-80", "port": 80, "protocol": "HTTP" } ] }
자세한 내용은 Amazon VPC Lattice 사용자 안내서의 라우팅 정의를 참조하세요.
-
API 세부 정보는 AWS CLI 명령 참조의 ListListeners
를 참조하세요.
-
다음 코드 예시에서는 list-service-network-service-associations
의 사용 방법을 보여줍니다.
- AWS CLI
-
서비스 연결 나열
다음
list-service-network-service-associations
예시에서는 지정된 서비스 네트워크의 서비스 연결을 나열합니다.--query
옵션은 출력 범위를 서비스 연결의 ID로 지정합니다.aws vpc-lattice list-service-network-service-associations \ --service-network-identifier
sn-080ec7dc93EXAMPLE
\ --queryitems[*].id
출력:
[ "snsa-031fabb4d8EXAMPLE", "snsa-0e16955a8cEXAMPLE" ]
자세한 내용은 Amazon VPC Lattice 사용자 안내서의 서비스 연결 관리를 참조하세요.
-
API 세부 정보는 AWS CLI 명령 참조의 ListServiceNetworkServiceAssociations
를 참조하세요.
-
다음 코드 예시에서는 list-service-network-vpc-associations
의 사용 방법을 보여줍니다.
- AWS CLI
-
VPC 연결 나열
다음
list-service-network-vpc-associations
예시에서는 지정된 서비스 네트워크의 VPC 연결을 나열합니다.--query
옵션은 출력 범위를 VPC 연결의 ID로 지정합니다.aws vpc-lattice list-service-network-vpc-associations \ --service-network-identifier
sn-080ec7dc93EXAMPLE
\ --queryitems[*].id
출력:
[ "snva-0821fc8631EXAMPLE", "snva-0c5dcb60d6EXAMPLE" ]
자세한 내용은 Amazon VPC Lattice 사용자 안내서의 VPC 연결 관리를 참조하세요.
-
API 세부 정보는 AWS CLI 명령 참조의 ListServiceNetworkVpcAssociations
를 참조하세요.
-
다음 코드 예시에서는 list-service-networks
의 사용 방법을 보여줍니다.
- AWS CLI
-
서비스 네트워크 나열
다음
list-service-networks
예시에서는 직접 호출하는 계정이 소유하거나 해당 계정에 공유된 서비스 네트워크를 나열합니다.--query
옵션은 결과 범위를 서비스 네트워크의 Amazon 리소스 이름(ARN)으로 지정합니다.aws vpc-lattice list-service-networks \ --query
items[*].arn
출력:
[ "arn:aws:vpc-lattice:us-east-2:123456789012:servicenetwork/sn-080ec7dc93EXAMPLE", "arn:aws:vpc-lattice:us-east-2:111122223333:servicenetwork/sn-0ec4d436cfEXAMPLE" ]
자세한 내용은 Amazon VPC Lattice 사용자 안내서의 서비스 네트워크를 참조하세요.
-
API 세부 정보는 AWS CLI 명령 참조의 ListServiceNetworks
를 참조하세요.
-
다음 코드 예시에서는 list-services
의 사용 방법을 보여줍니다.
- AWS CLI
-
서비스 나열
다음
list-services
예시에서는 직접 호출하는 계정이 소유하거나 해당 계정에 공유된 서비스를 나열합니다.--query
옵션은 결과 범위를 서비스의 Amazon 리소스 이름(ARN)으로 지정합니다.aws vpc-lattice list-services \ --query
items[*].arn
출력:
[ "arn:aws:vpc-lattice:us-east-2:123456789012:service/svc-0285b53b2eEXAMPLE", "arn:aws:vpc-lattice:us-east-2:111122223333:service/svc-0b8ac96550EXAMPLE" ]
자세한 내용은 Amazon VPC Lattice 사용자 안내서의 서비스를 참조하세요.
-
API 세부 정보는 AWS CLI 명령 참조의 ListServices
를 참조하세요.
-
다음 코드 예시에서는 list-target-groups
의 사용 방법을 보여줍니다.
- AWS CLI
-
대상 그룹 나열
다음
list-target-groups
예시에서는 대상 유형이LAMBDA
인 대상 그룹을 나열합니다.aws vpc-lattice list-target-groups \ --target-group-type
LAMBDA
출력:
{ "items": [ { "arn": "arn:aws:vpc-lattice:us-east-2:123456789012:targetgroup/tg-045c1b7d9dEXAMPLE", "createdAt": "2023-05-06T05:22:16.637Z", "id": "tg-045c1b7d9dEXAMPLE", "lastUpdatedAt": "2023-05-06T05:22:16.637Z", "name": "my-target-group-lam", "serviceArns": [ "arn:aws:vpc-lattice:us-east-2:123456789012:service/svc-0285b53b2eEXAMPLE" ], "status": "ACTIVE", "type": "LAMBDA" } ] }
자세한 내용은 Amazon VPC Lattice 사용자 안내서의 대상 그룹을 참조하세요.
-
API 세부 정보는 AWS CLI 명령 참조의 ListTargetGroups
를 참조하세요.
-
다음 코드 예시에서는 list-targets
의 사용 방법을 보여줍니다.
- AWS CLI
-
대상 그룹의 대상 나열
다음
list-targets
예시에서는 지정된 대상 그룹의 대상을 나열합니다.aws vpc-lattice list-targets \ --target-group-identifier
tg-0eaa4b9ab4EXAMPLE
출력:
{ "items": [ { "id": "i-07dd579bc5EXAMPLE", "port": 443, "status": "HEALTHY" }, { "id": "i-047b3c9078EXAMPLE", "port": 443, "reasonCode": "HealthCheckFailed", "status": "UNHEALTHY" } ] }
자세한 내용은 Amazon VPC Lattice 사용자 안내서의 대상 그룹을 참조하세요.
-
API 세부 정보는 AWS CLI 명령 참조의 ListTargets
를 참조하세요.
-
다음 코드 예시에서는 put-auth-policy
의 사용 방법을 보여줍니다.
- AWS CLI
-
서비스 인증 정책 생성
다음
put-auth-policy
예시에서는 지정된 IAM 역할을 사용하는 인증된 위탁자의 요청에 대한 액세스 권한을 부여합니다. 리소스는 정책이 연결된 서비스의 ARN입니다.aws vpc-lattice put-auth-policy \ --resource-identifier
svc-0285b53b2eEXAMPLE
\ --policyfile://auth-policy.json
auth-policy.json
의 콘텐츠:{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Principal": { "AWS": "arn:aws:iam::123456789012:role/my-clients" }, "Action": "vpc-lattice-svcs:Invoke", "Resource": "arn:aws:vpc-lattice:us-east-2:123456789012:service/svc-0285b53b2eEXAMPLE" } ] }
출력:
{ "policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Effect\":\"Allow\",\"Principal\":{\"AWS\":\"arn:aws:iam::123456789012:role/my-clients\"},\"Action\":\"vpc-lattice-svcs:Invoke\",\"Resource\":\"arn:aws:vpc-lattice:us-east-2:123456789012:service/svc-0285b53b2eEXAMPLE\"}]}", "state": "Active" }
자세한 내용은 Amazon VPC Lattice 사용자 안내서의 인증 정책을 참조하세요.
-
API 세부 정보는 AWS CLI 명령 참조의 PutAuthPolicy
를 참조하세요.
-
다음 코드 예시에서는 register-targets
의 사용 방법을 보여줍니다.
- AWS CLI
-
대상 등록
다음
register-targets
예시에서는 지정된 대상 그룹에 지정된 대상을 등록합니다.aws vpc-lattice register-targets \ --targets
id=i-047b3c9078EXAMPLE
id=i-07dd579bc5EXAMPLE
\ --target-group-identifiertg-0eaa4b9ab4EXAMPLE
출력:
{ "successful": [ { "id": "i-07dd579bc5EXAMPLE", "port": 443 } ], "unsuccessful": [ { "failureCode": "UnsupportedTarget", "failureMessage": "Instance targets must be in the same VPC as their target group", "id": "i-047b3c9078EXAMPLE", "port": 443 } ] }
자세한 내용은 Amazon VPC Lattice 사용자 안내서의 대상 등록을 참조하세요.
-
API 세부 정보는 AWS CLI 명령 참조의 RegisterTargets
를 참조하세요.
-