

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.

# Añadir una plantilla de lanzamiento
<a name="project-launch-template"></a>

Al crear o editar un proyecto, puede añadir plantillas de lanzamiento mediante las **opciones avanzadas** de la configuración del proyecto. Las plantillas de lanzamiento proporcionan configuraciones adicionales, como grupos de seguridad, políticas de IAM y scripts de lanzamiento, para todas las instancias de VDI del proyecto. 

## Añada políticas
<a name="add-policies"></a>

Puede añadir una política de IAM para controlar el acceso a la VDI de todas las instancias implementadas en su proyecto. Para incorporar una política, etiquétela con el siguiente par clave-valor:

```
res:Resource/vdi-host-policy
```

Para obtener más información sobre las funciones de IAM, consulte [Políticas y permisos](https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html) en IAM.

### Añadir grupos de seguridad
<a name="add-security-groups"></a>

Puede añadir un grupo de seguridad para controlar los datos de entrada y salida de todas las instancias de VDI de su proyecto. Para incorporar un grupo de seguridad, etiquete el grupo de seguridad con el siguiente par clave-valor:

```
res:Resource/vdi-security-group
```

Para obtener más información sobre los grupos de seguridad, consulte [Controlar el tráfico de sus AWS recursos mediante grupos de seguridad](https://docs.aws.amazon.com/vpc/latest/userguide/vpc-security-groups.html) en la Guía del *usuario de Amazon VPC*.

### Añada scripts de lanzamiento
<a name="project-launch-scripts"></a>

Puede añadir scripts de lanzamiento que se iniciarán en todas las sesiones de VDI del proyecto. RES admite el inicio de scripts para Linux y Windows. Para iniciar el script, puede elegir entre las siguientes opciones:

**Ejecute el script cuando se inicie VDI**  
Esta opción inicia el script al principio de una instancia de VDI antes de que se ejecute cualquier configuración o instalación de RES.

**Ejecute el script cuando VDI esté configurado**  
Esta opción inicia el script una vez finalizadas las configuraciones de RES.

Los scripts admiten las siguientes opciones:


| Configuración de scripts | Ejemplo | 
| --- | --- | 
| S3 URI | s3://bucketname/script.sh | 
| URL HTTPS | https://sample.samplecontent.com/sample | 
| Archivo local | archivo:///.sh user/scripts/example | 

Todos los scripts personalizados que se alojan en buckets de S3 deben aprovisionarse con la siguiente etiqueta:

```
res:EnvironmentName/<res-environment>
```

En el caso de **los argumentos**, proporciona los argumentos separados por una coma.

![\[Ejemplo de configuración de un proyecto\]](http://docs.aws.amazon.com/es_es/res/latest/ug/images/res-projectconfigexample.png)


Ejemplos de plantillas para scripts de lanzamiento.

------
#### [ Linux ]

```
#  Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
#  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://www.apache.org/licenses/LICENSE-2.0
#
#  or in the 'license' file accompanying this file. This file is distributed on an 'AS IS' BASIS, WITHOUT WARRANTIES
#  OR CONDITIONS OF ANY KIND, express or implied. See the License for the specific language governing permissions
#  and limitations under the License.

#!/bin/bash

echo "start_script.sh running" >> /test_scripts
echo "All arguments: $@" >> /test_scripts
echo "Argument count: $#" >> /test_scripts
echo "Argument 1, $1" >> /test_scripts
echo "Argument 2, $2" >> /test_scripts
echo "end of start_script.sh" >> /test_scripts
```

------
#### [ Windows ]

```
#  Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
#  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://www.apache.org/licenses/LICENSE-2.0
#
#  or in the 'license' file accompanying this file. This file is distributed on an 'AS IS' BASIS, WITHOUT WARRANTIES
#  OR CONDITIONS OF ANY KIND, express or implied. See the License for the specific language governing permissions
#  and limitations under the License.

#!pwsh

Write-Output "configure_script.ps1 running" | Out-File -Append -FilePath "/test_scripts"
Write-Output "All arguments: $args" | Out-File -Append -FilePath "/test_scripts"
Write-Output "Argument count: $($args.Count)" | Out-File -Append -FilePath "/test_scripts"
Write-Output "Argument 1, $($args[0])" | Out-File -Append -FilePath "/test_scripts"
Write-Output "Argument 2, $($args[1])" | Out-File -Append -FilePath "/test_scripts"
Write-Output "end of configure_script.ps1" | Out-File -Append -FilePath "/test_scripts"
```

------