Cmdlet 검색 및 별칭 - AWS Tools for PowerShell

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

Cmdlet 검색 및 별칭

이 단원에서는 AWS Tools for PowerShell에서 지원하는 서비스 목록을 표시하는 방법, 이러한 서비스를 지원하기 위해 AWS Tools for PowerShell에서 제공하는 cmdlet 세트를 표시하는 방법, 이러한 서비스에 액세스하기 위해 대체 cmdlet 이름(별칭)을 찾는 방법을 설명합니다.

Cmdlet 검색

모든 AWS 서비스 작업(또는 API) 은 각 서비스에 대한 API 참조 안내서에 설명되어 있습니다. 예를 들면 IAM API 참조를 참조하세요. 대부분의 경우 AWS 서비스 API와 AWS PowerShell cmdlet 간에는 일대일 통신이 있습니다. AWS 서비스 API 이름에 해당하는 cmdlet 이름을 가져오려면 -ApiOperation 파라미터 및 AWS 서비스 API 이름을 지정하여 AWS Get-AWSCmdletName cmdlet을 실행합니다. 예를 들어 사용 가능한 DescribeInstances AWS 서비스 API를 기반으로 하는 모든 cmdlet 이름을 가져오려면 다음 명령을 실행합니다.

PS > Get-AWSCmdletName -ApiOperation DescribeInstances CmdletName ServiceOperation ServiceName CmdletNounPrefix ---------- ---------------- ----------- ---------------- Get-EC2Instance DescribeInstances Amazon Elastic Compute Cloud EC2 Get-GMLInstance DescribeInstances Amazon GameLift Service GML

-ApiOperation 매개 변수가 기본 매개 변수이므로 매개 변수 이름을 생략할 수 있습니다. 다음 예제는 이전 예제와 동일합니다.

PS > Get-AWSCmdletName DescribeInstances

API와 서비스의 이름을 둘 다 알고 있는 경우 -Service 파라미터와 함께 cmdlet 명사 접두사나 AWS 서비스 이름의 일부를 포함시킬 수 있습니다. 예를 들면 Amazon EC2의 cmdlet 명사 접두사는 EC2입니다. Amazon EC2 서비스에서 DescribeInstances API에 해당하는 cmdlet 이름을 가져오려면 다음 명령 중 하나를 실행합니다. 이들은 모두 동일한 출력의 결과입니다.

PS > Get-AWSCmdletName -ApiOperation DescribeInstances -Service EC2 PS > Get-AWSCmdletName -ApiOperation DescribeInstances -Service Compute PS > Get-AWSCmdletName -ApiOperation DescribeInstances -Service "Compute Cloud" CmdletName ServiceOperation ServiceName CmdletNounPrefix ---------- ---------------- ----------- ---------------- Get-EC2Instance DescribeInstances Amazon Elastic Compute Cloud EC2

이러한 명령의 파라미터 값은 대/소문자를 구분합니다.

원하는 AWS 서비스 API나 AWS 서비스의 이름을 모르는 경우에는 -ApiOperation 파라미터와 함께 일치하는 패턴 및 -MatchWithRegex 파라미터를 사용할 수 있습니다. 예를 들어 SecurityGroup을 포함하는 사용 가능한 cmdlet 이름을 모두 가져오려면 다음 명령을 실행합니다.

PS > Get-AWSCmdletName -ApiOperation SecurityGroup -MatchWithRegex CmdletName ServiceOperation ServiceName CmdletNounPrefix ---------- ---------------- ----------- ---------------- Approve-ECCacheSecurityGroupIngress AuthorizeCacheSecurityGroupIngress Amazon ElastiCache EC Get-ECCacheSecurityGroup DescribeCacheSecurityGroups Amazon ElastiCache EC New-ECCacheSecurityGroup CreateCacheSecurityGroup Amazon ElastiCache EC Remove-ECCacheSecurityGroup DeleteCacheSecurityGroup Amazon ElastiCache EC Revoke-ECCacheSecurityGroupIngress RevokeCacheSecurityGroupIngress Amazon ElastiCache EC Add-EC2SecurityGroupToClientVpnTargetNetwrk ApplySecurityGroupsToClientVpnTargetNetwork Amazon Elastic Compute Cloud EC2 Get-EC2SecurityGroup DescribeSecurityGroups Amazon Elastic Compute Cloud EC2 Get-EC2SecurityGroupReference DescribeSecurityGroupReferences Amazon Elastic Compute Cloud EC2 Get-EC2StaleSecurityGroup DescribeStaleSecurityGroups Amazon Elastic Compute Cloud EC2 Grant-EC2SecurityGroupEgress AuthorizeSecurityGroupEgress Amazon Elastic Compute Cloud EC2 Grant-EC2SecurityGroupIngress AuthorizeSecurityGroupIngress Amazon Elastic Compute Cloud EC2 New-EC2SecurityGroup CreateSecurityGroup Amazon Elastic Compute Cloud EC2 Remove-EC2SecurityGroup DeleteSecurityGroup Amazon Elastic Compute Cloud EC2 Revoke-EC2SecurityGroupEgress RevokeSecurityGroupEgress Amazon Elastic Compute Cloud EC2 Revoke-EC2SecurityGroupIngress RevokeSecurityGroupIngress Amazon Elastic Compute Cloud EC2 Update-EC2SecurityGroupRuleEgressDescription UpdateSecurityGroupRuleDescriptionsEgress Amazon Elastic Compute Cloud EC2 Update-EC2SecurityGroupRuleIngressDescription UpdateSecurityGroupRuleDescriptionsIngress Amazon Elastic Compute Cloud EC2 Edit-EFSMountTargetSecurityGroup ModifyMountTargetSecurityGroups Amazon Elastic File System EFS Get-EFSMountTargetSecurityGroup DescribeMountTargetSecurityGroups Amazon Elastic File System EFS Join-ELBSecurityGroupToLoadBalancer ApplySecurityGroupsToLoadBalancer Elastic Load Balancing ELB Set-ELB2SecurityGroup SetSecurityGroups Elastic Load Balancing V2 ELB2 Enable-RDSDBSecurityGroupIngress AuthorizeDBSecurityGroupIngress Amazon Relational Database Service RDS Get-RDSDBSecurityGroup DescribeDBSecurityGroups Amazon Relational Database Service RDS New-RDSDBSecurityGroup CreateDBSecurityGroup Amazon Relational Database Service RDS Remove-RDSDBSecurityGroup DeleteDBSecurityGroup Amazon Relational Database Service RDS Revoke-RDSDBSecurityGroupIngress RevokeDBSecurityGroupIngress Amazon Relational Database Service RDS Approve-RSClusterSecurityGroupIngress AuthorizeClusterSecurityGroupIngress Amazon Redshift RS Get-RSClusterSecurityGroup DescribeClusterSecurityGroups Amazon Redshift RS New-RSClusterSecurityGroup CreateClusterSecurityGroup Amazon Redshift RS Remove-RSClusterSecurityGroup DeleteClusterSecurityGroup Amazon Redshift RS Revoke-RSClusterSecurityGroupIngress RevokeClusterSecurityGroupIngress Amazon Redshift RS

AWS 서비스의 이름은 알지만 AWS 서비스 API의 이름을 모르는 경우에는 검색 범위를 단일 서비스로 지정할 수 있도록 -MatchWithRegex 파라미터와 -Service 파라미터를 모두 포함시킵니다. 예를 들어 Amazon EC2 서비스에서만 SecurityGroup을 포함하는 모든 cmdlet 이름을 모두 가져오려면 다음 명령을 실행합니다.

PS > Get-AWSCmdletName -ApiOperation SecurityGroup -MatchWithRegex -Service EC2 CmdletName ServiceOperation ServiceName CmdletNounPrefix ---------- ---------------- ----------- ---------------- Add-EC2SecurityGroupToClientVpnTargetNetwrk ApplySecurityGroupsToClientVpnTargetNetwork Amazon Elastic Compute Cloud EC2 Get-EC2SecurityGroup DescribeSecurityGroups Amazon Elastic Compute Cloud EC2 Get-EC2SecurityGroupReference DescribeSecurityGroupReferences Amazon Elastic Compute Cloud EC2 Get-EC2StaleSecurityGroup DescribeStaleSecurityGroups Amazon Elastic Compute Cloud EC2 Grant-EC2SecurityGroupEgress AuthorizeSecurityGroupEgress Amazon Elastic Compute Cloud EC2 Grant-EC2SecurityGroupIngress AuthorizeSecurityGroupIngress Amazon Elastic Compute Cloud EC2 New-EC2SecurityGroup CreateSecurityGroup Amazon Elastic Compute Cloud EC2 Remove-EC2SecurityGroup DeleteSecurityGroup Amazon Elastic Compute Cloud EC2 Revoke-EC2SecurityGroupEgress RevokeSecurityGroupEgress Amazon Elastic Compute Cloud EC2 Revoke-EC2SecurityGroupIngress RevokeSecurityGroupIngress Amazon Elastic Compute Cloud EC2 Update-EC2SecurityGroupRuleEgressDescription UpdateSecurityGroupRuleDescriptionsEgress Amazon Elastic Compute Cloud EC2 Update-EC2SecurityGroupRuleIngressDescription UpdateSecurityGroupRuleDescriptionsIngress Amazon Elastic Compute Cloud EC2

AWS Command Line Interface(AWS CLI) 명령의 이름을 알고 있는 경우에는 -AwsCliCommand 매개 변수와 원하는 AWS CLI 명령 이름을 사용하여 동일한 API를 기반으로 하는 cmdlet 이름을 가져올 수 있습니다. 예를 들어 Amazon EC2 서비스에서 authorize-security-group-ingress AWS CLI 명령 호출에 해당하는 cmdlet 이름을 가져오려면 다음 명령을 실행합니다.

PS > Get-AWSCmdletName -AwsCliCommand "aws ec2 authorize-security-group-ingress" CmdletName ServiceOperation ServiceName CmdletNounPrefix ---------- ---------------- ----------- ---------------- Grant-EC2SecurityGroupIngress AuthorizeSecurityGroupIngress Amazon Elastic Compute Cloud EC2

Get-AWSCmdletName cmdlet은 AWS CLI 명령 이름만 있으면 서비스와 AWS API를 식별할 수 있습니다.

Tools for PowerShell Core의 모든 cmdlet의 목록을 가져오려면 다음 예제에 나와 있는 것처럼 PowerShell Get-Command cmdlet을 실행합니다.

PS > Get-Command -Module AWSPowerShell.NetCore

-Module AWSPowerShell과 동일한 명령을 실행하여 AWS Tools for Windows PowerShell의 cmdlet을 확인할 수 있습니다.

Get-Command cmdlet은 cmdlet 목록을 알파벳순으로 생성합니다. 기본적으로 목록은 PowerShell 명사가 아닌 PowerShell 동사로 정렬됩니다.

그와 달리 서비스별로 결과를 정렬하려면 다음 명령을 실행합니다.

PS > Get-Command -Module AWSPowerShell.NetCore | Sort-Object Noun,Verb

Get-Command cmdlet에 의해 반환되는 cmdlet을 필터링하려면 출력을 PowerShell Select-String cmdlet에 파이프합니다. 예를 들어 AWS 리전에서 사용하는 cmdlet 세트를 보려면 다음 명령을 실행합니다.

PS > Get-Command -Module AWSPowerShell.NetCore | Select-String region Clear-DefaultAWSRegion Copy-HSM2BackupToRegion Get-AWSRegion Get-DefaultAWSRegion Get-EC2Region Get-LSRegionList Get-RDSSourceRegion Set-DefaultAWSRegion

또한 cmdlet 명사의 서비스 접두사를 필터링하여 특정 서비스에 대한 cmdlet을 찾을 수도 있습니다. 사용 가능한 서비스 접두사 목록을 보려면 Get-AWSPowerShellVersion -ListServiceVersionInfo을 실행합니다. 다음 예제는 Amazon CloudWatch Events 서비스를 지원하는 cmdlet을 반환합니다.

PS > Get-Command -Module AWSPowerShell -Noun CWE* CommandType Name Version Source ----------- ---- ------- ------ Cmdlet Add-CWEResourceTag 3.3.563.1 AWSPowerShell.NetCore Cmdlet Disable-CWEEventSource 3.3.563.1 AWSPowerShell.NetCore Cmdlet Disable-CWERule 3.3.563.1 AWSPowerShell.NetCore Cmdlet Enable-CWEEventSource 3.3.563.1 AWSPowerShell.NetCore Cmdlet Enable-CWERule 3.3.563.1 AWSPowerShell.NetCore Cmdlet Get-CWEEventBus 3.3.563.1 AWSPowerShell.NetCore Cmdlet Get-CWEEventBusList 3.3.563.1 AWSPowerShell.NetCore Cmdlet Get-CWEEventSource 3.3.563.1 AWSPowerShell.NetCore Cmdlet Get-CWEEventSourceList 3.3.563.1 AWSPowerShell.NetCore Cmdlet Get-CWEPartnerEventSource 3.3.563.1 AWSPowerShell.NetCore Cmdlet Get-CWEPartnerEventSourceAccountList 3.3.563.1 AWSPowerShell.NetCore Cmdlet Get-CWEPartnerEventSourceList 3.3.563.1 AWSPowerShell.NetCore Cmdlet Get-CWEResourceTag 3.3.563.1 AWSPowerShell.NetCore Cmdlet Get-CWERule 3.3.563.1 AWSPowerShell.NetCore Cmdlet Get-CWERuleDetail 3.3.563.1 AWSPowerShell.NetCore Cmdlet Get-CWERuleNamesByTarget 3.3.563.1 AWSPowerShell.NetCore Cmdlet Get-CWETargetsByRule 3.3.563.1 AWSPowerShell.NetCore Cmdlet New-CWEEventBus 3.3.563.1 AWSPowerShell.NetCore Cmdlet New-CWEPartnerEventSource 3.3.563.1 AWSPowerShell.NetCore Cmdlet Remove-CWEEventBus 3.3.563.1 AWSPowerShell.NetCore Cmdlet Remove-CWEPartnerEventSource 3.3.563.1 AWSPowerShell.NetCore Cmdlet Remove-CWEPermission 3.3.563.1 AWSPowerShell.NetCore Cmdlet Remove-CWEResourceTag 3.3.563.1 AWSPowerShell.NetCore Cmdlet Remove-CWERule 3.3.563.1 AWSPowerShell.NetCore Cmdlet Remove-CWETarget 3.3.563.1 AWSPowerShell.NetCore Cmdlet Test-CWEEventPattern 3.3.563.1 AWSPowerShell.NetCore Cmdlet Write-CWEEvent 3.3.563.1 AWSPowerShell.NetCore Cmdlet Write-CWEPartnerEvent 3.3.563.1 AWSPowerShell.NetCore Cmdlet Write-CWEPermission 3.3.563.1 AWSPowerShell.NetCore Cmdlet Write-CWERule 3.3.563.1 AWSPowerShell.NetCore Cmdlet Write-CWETarget 3.3.563.1 AWSPowerShell.NetCore

Cmdlet 이름 지정 및 별칭

AWS Tools for PowerShell에서 각 서비스용 cmdlet은 해당 서비스용 AWS SDK에서 제공하는 메서드를 기반으로 합니다. 하지만 PowerShell의 이름 지정 규칙 때문에 cmdlet의 이름이 해당 API 호출이나 기반이 되는 메서드의 이름과 다를 수 있습니다. 예를 들어 Get-EC2Instance cmdlet은 Amazon EC2 DescribeInstances 메서드를 기반으로 합니다.

경우에 따라, cmdlet 이름이 메서드 이름과 비슷하지만, 실제로는 다른 기능을 수행할 수도 있습니다. 예를 들어 Amazon S3GetObject 메서드는 Amazon S3 객체를 검색합니다. 그러나, Get-S3Object cmdlet은 객체 자체보다 Amazon S3 객체에 대한 정보를 반환합니다.

PS > Get-S3Object -BucketName text-content -Key aws-tech-docs ETag : "df000002a0fe0000f3c000004EXAMPLE" BucketName : aws-tech-docs Key : javascript/frameset.js LastModified : 6/13/2011 1:24:18 PM Owner : Amazon.S3.Model.Owner Size : 512 StorageClass : STANDARD

AWS Tools for PowerShell를 사용하여 S3 객체를 검색하려면 Read-S3Object cmdlet을 실행합니다.

PS > Read-S3Object -BucketName text-content -Key text-object.txt -file c:\tmp\text-object-download.text Mode LastWriteTime Length Name ---- ------------- ------ ---- -a--- 11/5/2012 7:29 PM 20622 text-object-download.text
참고

cmdlet에 해당하는 AWS SDK API의 이름은 AWS cmdlet의 해당 cmdlet 도움말에 나와 있습니다.

표준 PowerShell 동사와 예상 의미에 대한 자세한 내용은 PowerShell 명령에 대해 승인된 동사를 참조하십시오.

Remove 동사를 사용하는 모든 AWS cmdlet과 -Terminate 파라미터를 추가할 때 Stop-EC2Instance cmdlet은 계속하기 전에 확인 메시지를 표시합니다. 확인 메시지를 건너뛰려면 명령에 -Force 파라미터를 추가합니다.

중요

AWS cmdlet은 -WhatIf 스위치를 지원하지 않습니다.

별칭

AWS Tools for PowerShell을 설정하면 다수의 AWS cmdlet에 대한 별칭을 포함하는 별칭 파일이 설치됩니다. 이러한 별칭은 cmdlet 이름보다 더 직관적입니다. 예를 들어 서비스 이름과 AWS SDK 메서드 이름은 일부 별칭의 PowerShell 동사와 명사를 대체합니다. 예를 들면 EC2-DescribeInstances 별칭이 있습니다.

그 밖의 별칭에는, 표준 PowerShell 표기 규칙을 따르지는 않지만 실제 작업을 더 잘 설명할 수 있는 동사가 사용됩니다. 예를 들면 별칭 파일은 Get-S3Content 별칭을 Read-S3Object cmdlet으로 매핑합니다.

PS > Set-Alias -Name Get-S3Content -Value Read-S3Object

별칭 파일은 AWS Tools for PowerShell 설치 디렉터리에 있습니다. 별칭을 환경에 로드하려면 파일을 도트 소싱(dot-sourcing)합니다. 다음은 Windows용 예입니다.

PS > . "C:\Program Files (x86)\AWS Tools\PowerShell\AWSPowershell\AWSAliases.ps1"

Linux 또는 macOS 셸의 경우 다음과 같이 보일 수 있습니다.

. ~/.local/share/powershell/Modules/AWSPowerShell.NetCore/3.3.563.1/AWSAliases.ps1

모든 AWS Tools for PowerShell 별칭을 표시하려면 다음 명령을 실행합니다. 이 명령은 PowerShell Where-Object cmdlet의 ? 별칭과 Source 속성을 사용하여 AWSPowerShell.NetCore 모듈에서 나온 별칭만 필터링합니다.

PS > Get-Alias | ? Source -like "AWSPowerShell.NetCore" CommandType Name Version Source ----------- ---- ------- ------ Alias Add-ASInstances 3.3.343.0 AWSPowerShell Alias Add-CTTag 3.3.343.0 AWSPowerShell Alias Add-DPTags 3.3.343.0 AWSPowerShell Alias Add-DSIpRoutes 3.3.343.0 AWSPowerShell Alias Add-ELBTags 3.3.343.0 AWSPowerShell Alias Add-EMRTag 3.3.343.0 AWSPowerShell Alias Add-ESTag 3.3.343.0 AWSPowerShell Alias Add-MLTag 3.3.343.0 AWSPowerShell Alias Clear-AWSCredentials 3.3.343.0 AWSPowerShell Alias Clear-AWSDefaults 3.3.343.0 AWSPowerShell Alias Dismount-ASInstances 3.3.343.0 AWSPowerShell Alias Edit-EC2Hosts 3.3.343.0 AWSPowerShell Alias Edit-RSClusterIamRoles 3.3.343.0 AWSPowerShell Alias Enable-ORGAllFeatures 3.3.343.0 AWSPowerShell Alias Find-CTEvents 3.3.343.0 AWSPowerShell Alias Get-ASACases 3.3.343.0 AWSPowerShell Alias Get-ASAccountLimits 3.3.343.0 AWSPowerShell Alias Get-ASACommunications 3.3.343.0 AWSPowerShell Alias Get-ASAServices 3.3.343.0 AWSPowerShell Alias Get-ASASeverityLevels 3.3.343.0 AWSPowerShell Alias Get-ASATrustedAdvisorCheckRefreshStatuses 3.3.343.0 AWSPowerShell Alias Get-ASATrustedAdvisorChecks 3.3.343.0 AWSPowerShell Alias Get-ASATrustedAdvisorCheckSummaries 3.3.343.0 AWSPowerShell Alias Get-ASLifecycleHooks 3.3.343.0 AWSPowerShell Alias Get-ASLifecycleHookTypes 3.3.343.0 AWSPowerShell Alias Get-AWSCredentials 3.3.343.0 AWSPowerShell Alias Get-CDApplications 3.3.343.0 AWSPowerShell Alias Get-CDDeployments 3.3.343.0 AWSPowerShell Alias Get-CFCloudFrontOriginAccessIdentities 3.3.343.0 AWSPowerShell Alias Get-CFDistributions 3.3.343.0 AWSPowerShell Alias Get-CFGConfigRules 3.3.343.0 AWSPowerShell Alias Get-CFGConfigurationRecorders 3.3.343.0 AWSPowerShell Alias Get-CFGDeliveryChannels 3.3.343.0 AWSPowerShell Alias Get-CFInvalidations 3.3.343.0 AWSPowerShell Alias Get-CFNAccountLimits 3.3.343.0 AWSPowerShell Alias Get-CFNStackEvents 3.3.343.0 AWSPowerShell ...

이 파일에 사용자 지정 별칭을 추가하려면 PowerShell의 $MaximumAliasCount 기본 설정 변수를 5500보다 큰 값으로 늘려야 할 수 있습니다. 기본값은 4096이며, 이 값을 최대 32768까지 높일 수 있습니다. 이렇게 하려면 다음을 실행합니다.

PS > $MaximumAliasCount = 32768

변경 사항이 성공적으로 적용되었는지 확인하려면 변수 이름을 입력하여 현재 값을 표시합니다.

PS > $MaximumAliasCount 32768