

Ada lebih banyak contoh AWS SDK yang tersedia di repo Contoh [SDK AWS Doc](https://github.com/awsdocs/aws-doc-sdk-examples). GitHub 

Terjemahan disediakan oleh mesin penerjemah. Jika konten terjemahan yang diberikan bertentangan dengan versi bahasa Inggris aslinya, utamakan versi bahasa Inggris.

# Gunakan `ValidateTemplate` dengan CLI
<a name="cloudformation_example_cloudformation_ValidateTemplate_section"></a>

Contoh kode berikut menunjukkan cara menggunakan`ValidateTemplate`.

------
#### [ CLI ]

**AWS CLI**  
**Untuk memvalidasi template AWS CloudFormation **  
`validate-template`Perintah berikut memvalidasi `sampletemplate.json` template:  

```
aws cloudformation validate-template --template-body file://sampletemplate.json
```
Output:  

```
{
    "Description": "AWS CloudFormation Sample Template S3_Bucket: Sample template showing how to create a publicly accessible S3 bucket. **WARNING** This template creates an S3 bucket. You will be billed for the AWS resources used if you create a stack from this template.",
    "Parameters": [],
    "Capabilities": []
}
```
Untuk informasi selengkapnya, lihat Bekerja dengan AWS CloudFormation Template di *Panduan AWS CloudFormation Pengguna*.  
+  Untuk detail API, lihat [ValidateTemplate](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/cloudformation/validate-template.html)di *Referensi AWS CLI Perintah*. 

------
#### [ PowerShell ]

**Alat untuk PowerShell V4**  
**Contoh 1: Memvalidasi konten template yang ditentukan. Output merinci kemampuan, deskripsi, dan parameter template.**  

```
Test-CFNTemplate -TemplateBody "{TEMPLATE CONTENT HERE}"
```
**Contoh 2: Memvalidasi template tertentu yang diakses melalui URL Amazon S3. Output merinci kemampuan, deskripsi, dan parameter template.**  

```
Test-CFNTemplate -TemplateURL https://s3.amazonaws.com/amzn-s3-demo-bucket/templatefile.template
```
+  Untuk detail API, lihat [ValidateTemplate](https://docs.aws.amazon.com/powershell/v4/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V4)*. 

**Alat untuk PowerShell V5**  
**Contoh 1: Memvalidasi konten template yang ditentukan. Output merinci kemampuan, deskripsi, dan parameter template.**  

```
Test-CFNTemplate -TemplateBody "{TEMPLATE CONTENT HERE}"
```
**Contoh 2: Memvalidasi template tertentu yang diakses melalui URL Amazon S3. Output merinci kemampuan, deskripsi, dan parameter template.**  

```
Test-CFNTemplate -TemplateURL https://s3.amazonaws.com/amzn-s3-demo-bucket/templatefile.template
```
+  Untuk detail API, lihat [ValidateTemplate](https://docs.aws.amazon.com/powershell/v5/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V5)*. 

------