

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

# Gunakan `ModifySnapshotAttribute` dengan CLI
<a name="example_ec2_ModifySnapshotAttribute_section"></a>

Contoh kode berikut menunjukkan cara menggunakan`ModifySnapshotAttribute`.

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

**AWS CLI**  
**Contoh 1: Untuk memodifikasi atribut snapshot**  
`modify-snapshot-attribute`Contoh berikut memperbarui `createVolumePermission` atribut untuk snapshot yang ditentukan, menghapus izin volume untuk pengguna tertentu.  

```
aws ec2 modify-snapshot-attribute \
    --snapshot-id {{snap-1234567890abcdef0}} \
    --attribute {{createVolumePermission}} \
    --operation-type {{remove}} \
    --user-ids {{123456789012}}
```
**Contoh 2: Untuk membuat snapshot publik**  
`modify-snapshot-attribute`Contoh berikut membuat snapshot yang ditentukan publik.  

```
aws ec2 modify-snapshot-attribute \
    --snapshot-id {{snap-1234567890abcdef0}} \
    --attribute {{createVolumePermission}} \
    --operation-type {{add}} \
    --group-names {{all}}
```
+  Untuk detail API, lihat [ModifySnapshotAttribute](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ec2/modify-snapshot-attribute.html)di *Referensi AWS CLI Perintah*. 

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

**Alat untuk PowerShell V4**  
**Contoh 1: Contoh ini membuat snapshot yang ditentukan publik dengan menyetel CreateVolumePermission atributnya.**  

```
Edit-EC2SnapshotAttribute -SnapshotId snap-12345678 -Attribute CreateVolumePermission -OperationType Add -GroupName all
```
+  Untuk detail API, lihat [ModifySnapshotAttribute](https://docs.aws.amazon.com/powershell/v4/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V4)*. 

**Alat untuk PowerShell V5**  
**Contoh 1: Contoh ini membuat snapshot yang ditentukan publik dengan menyetel CreateVolumePermission atributnya.**  

```
Edit-EC2SnapshotAttribute -SnapshotId snap-12345678 -Attribute CreateVolumePermission -OperationType Add -GroupName all
```
+  Untuk detail API, lihat [ModifySnapshotAttribute](https://docs.aws.amazon.com/powershell/v5/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V5)*. 

------

Untuk daftar lengkap panduan pengembang AWS SDK dan contoh kode, lihat[Membuat EC2 sumber daya Amazon menggunakan AWS SDK](sdk-general-information-section.md). Topik ini juga mencakup informasi tentang memulai dan detail tentang versi SDK sebelumnya.