

¡Se Herramientas de AWS para PowerShell ha lanzado la versión 5 (V5) del\!

Para obtener información sobre los cambios más importantes y la migración de sus aplicaciones, consulte el tema [sobre migración](https://docs.aws.amazon.com/powershell/v5/userguide/migrating-v5.html).

 [https://docs.aws.amazon.com/powershell/v5/userguide/migrating-v5.html](https://docs.aws.amazon.com/powershell/v5/userguide/migrating-v5.html)

Las traducciones son generadas a través de traducción automática. En caso de conflicto entre la traducción y la version original de inglés, prevalecerá la version en inglés.

# Detección y alias de cmdlet
<a name="pstools-discovery-aliases"></a>

En esta sección, se muestra cómo enumerar los servicios compatibles con Herramientas de AWS para PowerShell, cómo mostrar el conjunto de cmdlets que proporciona para respaldar esos servicios y cómo buscar nombres de cmdlets alternativos (también denominados alias) para acceder a esos servicios. Herramientas de AWS para PowerShell 

## Detección de cmdlets
<a name="pstools-cmdlet-discovery"></a>

Todas las operaciones AWS de servicio (o APIs) se documentan en la Guía de referencia de la API de cada servicio. Por ejemplo, consulte la [Referencia de la API de IAM](https://docs.aws.amazon.com/IAM/latest/APIReference/). En la mayoría de los casos, existe una one-to-one correspondencia entre una API de AWS servicio y un AWS PowerShell cmdlet. Para obtener el nombre del cmdlet que corresponde al nombre de una API de AWS servicio, ejecute el AWS `Get-AWSCmdletName` cmdlet con el `-ApiOperation` parámetro y el nombre de la API de servicio. AWS Por ejemplo, para obtener todos los nombres de cmdlet posibles que se basen en cualquier API de `DescribeInstances` AWS servicio disponible, ejecute el siguiente comando:

```
PS > Get-AWSCmdletName -ApiOperation DescribeInstances

CmdletName        ServiceOperation    ServiceName                    CmdletNounPrefix
----------        ----------------    -----------                    ----------------
Get-EC2Instance   DescribeInstances   Amazon Elastic Compute Cloud   EC2
Get-GMLInstance   DescribeInstances   Amazon GameLift Service        GML
```

El parámetro `-ApiOperation` es el parámetro predeterminado, por lo que puede omitir el nombre del parámetro. El siguiente ejemplo es equivalente al anterior:

```
PS > Get-AWSCmdletName DescribeInstances
```

Si conoce los nombres de la API y del servicio, puede incluir el `-Service` parámetro junto con el prefijo del sustantivo del cmdlet o parte del nombre del servicio. AWS Por ejemplo, el prefijo sustantivo del cmdlet para Amazon es. EC2 `EC2` Para obtener el nombre del cmdlet que corresponde a la `DescribeInstances` API del EC2 servicio de Amazon, ejecuta uno de los siguientes comandos. Todos ellos dan como resultado la misma salida:

```
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
```

Los valores de los parámetros en estos comandos no distinguen entre mayúsculas y minúsculas.

Si no conoce el nombre de la API del AWS servicio deseado o del AWS servicio, puede usar el `-ApiOperation` parámetro, junto con el patrón que debe coincidir y el `-MatchWithRegex` parámetro. Por ejemplo, para obtener todos los nombres de cmdlet disponibles que contienen `SecurityGroup`, ejecute el siguiente comando:

```
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
```

Si conoce el nombre del AWS servicio pero no la API del AWS servicio, incluya tanto el `-MatchWithRegex` parámetro como el `-Service` parámetro para limitar la búsqueda a un solo servicio. Por ejemplo, para obtener todos los nombres de los cmdlets que contienen `SecurityGroup` únicamente el EC2 servicio Amazon, ejecute el siguiente comando

```
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
```

Si conoce el nombre del comando AWS Command Line Interface (AWS CLI), puede usar el `-AwsCliCommand` parámetro y el nombre del AWS CLI comando deseado para obtener el nombre del cmdlet que se basa en la misma API. Por ejemplo, para obtener el nombre del cmdlet que corresponde a la llamada de `authorize-security-group-ingress` AWS CLI comando en el EC2 servicio de Amazon, ejecute el siguiente comando:

```
PS > Get-AWSCmdletName -AwsCliCommand "aws ec2 authorize-security-group-ingress"

CmdletName                    ServiceOperation              ServiceName                  CmdletNounPrefix
----------                    ----------------              -----------                  ----------------
Grant-EC2SecurityGroupIngress AuthorizeSecurityGroupIngress Amazon Elastic Compute Cloud EC2
```

El `Get-AWSCmdletName` cmdlet solo necesita el nombre del AWS CLI comando suficiente para identificar el servicio y la API. AWS 

Para obtener una lista de todos los cmdlets de Tools for PowerShell Core, ejecute el PowerShell `Get-Command` cmdlet, como se muestra en el siguiente ejemplo.

```
PS > Get-Command -Module AWSPowerShell.NetCore
```

Puede ejecutar el mismo comando con `-Module AWSPowerShell` para ver los cmdlets en las AWS Tools for Windows PowerShell.

El cmdlet `Get-Command` genera la lista de cmdlets en orden alfabético. Tenga en cuenta que, de forma predeterminada, la lista se ordena por PowerShell verbo y no por sustantivo. PowerShell 

Para ordenar los resultados por servicio en su lugar, ejecute el siguiente comando:

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

Para filtrar los cmdlets devueltos por el `Get-Command` cmdlet, canalice el resultado al cmdlet. PowerShell `Select-String` Por ejemplo, para ver el conjunto de cmdlets que funcionan con las regiones, ejecute el siguiente comando: AWS 

```
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
```

También puede encontrar cmdlets para un servicio específico filtrando por el prefijo de servicio de los nombres de cmdlet. Para ver la lista de prefijos de servicio disponibles, ejecute `Get-AWSPowerShellVersion -ListServiceVersionInfo`. El siguiente ejemplo devuelve cmdlets compatibles con el servicio Amazon CloudWatch Events.

```
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
```

## Nomenclatura y alias de cmdlets
<a name="pstools-cmdlet-naming-aliases"></a>

Los cmdlets de cada servicio se basan en los métodos proporcionados por el AWS SDK Herramientas de AWS para PowerShell para el servicio. Sin embargo, debido a las convenciones PowerShell de nomenclatura obligatorias, el nombre de un cmdlet puede ser diferente del nombre de la llamada a la API o del método en el que se basa. Por ejemplo, el `Get-EC2Instance` cmdlet se basa en el método Amazon EC2`DescribeInstances`.

En algunos casos, el nombre de cmdlet puede ser similar a un nombre de método, pero realizar una función diferente. Por ejemplo, el método `GetObject` de Amazon S3 recupera un objeto de Amazon S3. Sin embargo, el cmdlet `Get-S3Object` devuelve *información* sobre un objeto de Amazon S3 en lugar del propio objeto.

```
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
```

Para obtener un objeto S3 con Herramientas de AWS para PowerShell, ejecute el `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
```

**nota**  
La ayuda sobre cmdlets de un AWS cmdlet proporciona el nombre de la API del AWS SDK en la que se basa el cmdlet.  
[Para obtener más información sobre los verbos estándar y sus significados, PowerShell consulte Verbos aprobados para comandos. PowerShell ](https://learn.microsoft.com/en-us/powershell/scripting/developer/cmdlet/approved-verbs-for-windows-powershell-commands)

Todos los AWS cmdlets que usan el `Remove` verbo (y el `Stop-EC2Instance` cmdlet cuando se agrega el `-Terminate` parámetro) solicitan confirmación antes de continuar. Para eludir la confirmación, añada el parámetro `-Force` a su comando.

**importante**  
AWS Los cmdlets no admiten el modificador. `-WhatIf`

### Alias
<a name="pstools-aliases"></a>

La configuración del Herramientas de AWS para PowerShell instala un archivo de alias que contiene los alias de muchos de los cmdlets. AWS Tal vez estos alias le resulten más intuitivos que los nombres de cmdlet. Por ejemplo, los nombres de los servicios y los nombres de los métodos AWS del SDK sustituyen a los PowerShell verbos y sustantivos en algunos alias. Un ejemplo es el alias `EC2-DescribeInstances`.

Otros alias usan verbos que, aunque no siguen las PowerShell convenciones estándar, pueden describir mejor la operación real. Por ejemplo, el archivo de alias asocia el alias `Get-S3Content` al cmdlet `Read-S3Object`.

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

El archivo de alias se encuentra en el directorio de instalación. Herramientas de AWS para PowerShell Para cargar los alias en su entorno, use la notación *dot-source* en el archivo. A continuación se muestra un ejemplo basado en Windows.

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

Para un shell de Linux o macOS, podría ser así:

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

Para mostrar todos los Herramientas de AWS para PowerShell alias, ejecute el siguiente comando. Este comando usa el `?` alias del PowerShell `Where-Object` cmdlet y la `Source` propiedad para filtrar únicamente los alias que provienen del módulo. `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

...
```

Para agregar sus propios alias a este archivo, puede que necesite aumentar el valor de la [variable PowerShell de `$MaximumAliasCount` preferencias a un valor superior](https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_preference_variables?view=powershell-6) a 5500. El valor predeterminado es 4096 y puede elevarlo a un máximo de 32 768. Para ello, haga lo siguiente.

```
PS > $MaximumAliasCount = 32768
```

Para verificar que el cambio se ha realizado correctamente, escriba el nombre de la variable para que muestre su valor actual.

```
PS > $MaximumAliasCount
32768
```