

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

# Amazon EFS contoh menggunakan AWS CLI
<a name="cli_efs_code_examples"></a>

Contoh kode berikut menunjukkan cara melakukan tindakan dan mengimplementasikan skenario umum dengan menggunakan AWS Command Line Interface with Amazon EFS.

*Tindakan* merupakan kutipan kode dari program yang lebih besar dan harus dijalankan dalam konteks. Sementara tindakan menunjukkan cara memanggil fungsi layanan individual, Anda dapat melihat tindakan dalam konteks dalam skenario terkait.

Setiap contoh menyertakan tautan ke kode sumber lengkap, di mana Anda dapat menemukan instruksi tentang cara mengatur dan menjalankan kode dalam konteks.

**Topics**
+ [Tindakan](#actions)

## Tindakan
<a name="actions"></a>

### `create-file-system`
<a name="efs_CreateFileSystem_cli_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`create-file-system`.

**AWS CLI**  
**Untuk membuat sistem file terenkripsi**  
`create-file-system`Contoh berikut membuat sistem file terenkripsi menggunakan CMK default. Itu juga menambahkan tag`Name=my-file-system`.  

```
aws efs create-file-system \
    --performance-mode generalPurpose \
    --throughput-mode bursting \
    --encrypted \
    --tags Key=Name,Value=my-file-system
```
Output:  

```
{
    "OwnerId": "123456789012",
    "CreationToken": "console-d7f56c5f-e433-41ca-8307-9d9c0example",
    "FileSystemId": "fs-c7a0456e",
    "FileSystemArn": "arn:aws:elasticfilesystem:us-west-2:123456789012:file-system/fs-48499b4d",
    "CreationTime": 1595286880.0,
    "LifeCycleState": "creating",
    "Name": "my-file-system",
    "NumberOfMountTargets": 0,
    "SizeInBytes": {
        "Value": 0,
        "ValueInIA": 0,
        "ValueInStandard": 0
    },
    "PerformanceMode": "generalPurpose",
    "Encrypted": true,
    "KmsKeyId": "arn:aws:kms:us-west-2:123456789012:key/a59b3472-e62c-42e4-adcf-30d92example",
    "ThroughputMode": "bursting",
    "Tags": [
        {
            "Key": "Name",
            "Value": "my-file-system"
        }
    ]
}
```
Untuk informasi selengkapnya, lihat [Membuat sistem file Amazon EFS](https://docs.aws.amazon.com/efs/latest/ug/creating-using-create-fs.html) di *Panduan Pengguna Amazon Elastic File System*.  
+  Untuk detail API, lihat [CreateFileSystem](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/efs/create-file-system.html)di *Referensi AWS CLI Perintah*. 

### `create-mount-target`
<a name="efs_CreateMountTarget_cli_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`create-mount-target`.

**AWS CLI**  
**Untuk membuat target mount**  
`create-mount-target`Contoh berikut membuat target mount untuk sistem file yang ditentukan.  

```
aws efs create-mount-target \
    --file-system-id fs-c7a0456e \
    --subnet-id subnet-02bf4c428bexample \
    --security-groups sg-068f739363example
```
Output:  

```
{
    "OwnerId": "123456789012",
    "MountTargetId": "fsmt-f9a14450",
    "FileSystemId": "fs-c7a0456e",
    "SubnetId": "subnet-02bf4c428bexample",
    "LifeCycleState": "creating",
    "IpAddress": "10.0.1.24",
    "NetworkInterfaceId": "eni-02d542216aexample",
    "AvailabilityZoneId": "use2-az2",
    "AvailabilityZoneName": "us-east-2b",
    "VpcId": "vpc-0123456789abcdef0"
}
```
Untuk informasi selengkapnya, lihat [Membuat target mount](https://docs.aws.amazon.com/efs/latest/ug/accessing-fs.html) di *Panduan Pengguna Amazon Elastic File System*.  
+  Untuk detail API, lihat [CreateMountTarget](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/efs/create-mount-target.html)di *Referensi AWS CLI Perintah*. 

### `delete-file-system`
<a name="efs_DeleteFileSystem_cli_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`delete-file-system`.

**AWS CLI**  
**Untuk menghapus sistem file**  
`delete-file-system`Contoh berikut menghapus sistem file yang ditentukan.  

```
aws efs delete-file-system \
    --file-system-id fs-c7a0456e
```
Perintah ini tidak menghasilkan output.  
Untuk informasi selengkapnya, lihat [Menghapus sistem file Amazon EFS](https://docs.aws.amazon.com/efs/latest/ug/delete-efs-fs.html) di *Panduan Pengguna Amazon Elastic File System*.  
+  Untuk detail API, lihat [DeleteFileSystem](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/efs/delete-file-system.html)di *Referensi AWS CLI Perintah*. 

### `delete-mount-target`
<a name="efs_DeleteMountTarget_cli_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`delete-mount-target`.

**AWS CLI**  
**Untuk menghapus target pemasangan**  
`delete-mount-target`Contoh berikut menghapus target mount yang ditentukan.  

```
aws efs delete-mount-target \
    --mount-target-id fsmt-f9a14450
```
Perintah ini tidak menghasilkan output.  
Untuk informasi selengkapnya, lihat [Membuat target mount](https://docs.aws.amazon.com/efs/latest/ug/accessing-fs.html) di *Panduan Pengguna Amazon Elastic File System*.  
+  Untuk detail API, lihat [DeleteMountTarget](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/efs/delete-mount-target.html)di *Referensi AWS CLI Perintah*. 

### `describe-file-systems`
<a name="efs_DescribeFileSystems_cli_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`describe-file-systems`.

**AWS CLI**  
**Untuk menggambarkan sistem file**  
`describe-file-systems`Contoh berikut menjelaskan sistem file yang ditentukan.  

```
aws efs describe-file-systems \
    --file-system-id fs-c7a0456e
```
Output:  

```
{
    "FileSystems": [
        {
            "OwnerId": "123456789012",
            "CreationToken": "console-d7f56c5f-e433-41ca-8307-9d9c0example",
            "FileSystemId": "fs-c7a0456e",
            "FileSystemArn": "arn:aws:elasticfilesystem:us-west-2:123456789012:file-system/fs-48499b4d",
            "CreationTime": 1595286880.0,
            "LifeCycleState": "available",
            "Name": "my-file-system",
            "NumberOfMountTargets": 3,
            "SizeInBytes": {
                "Value": 6144,
                "Timestamp": 1600991437.0,
                "ValueInIA": 0,
                "ValueInStandard": 6144
            },
            "PerformanceMode": "generalPurpose",
            "Encrypted": true,
            "KmsKeyId": "arn:aws:kms:us-west-2:123456789012:key/a59b3472-e62c-42e4-adcf-30d92example",
            "ThroughputMode": "bursting",
            "Tags": [
                {
                    "Key": "Name",
                    "Value": "my-file-system"
                }
            ]
        }
    ]
}
```
Untuk informasi selengkapnya, lihat [Mengelola sistem file Amazon EFS](https://docs.aws.amazon.com/efs/latest/ug/managing.html) di *Panduan Pengguna Amazon Elastic File System*.  
+  Untuk detail API, lihat [DescribeFileSystems](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/efs/describe-file-systems.html)di *Referensi AWS CLI Perintah*. 

### `describe-mount-targets`
<a name="efs_DescribeMountTargets_cli_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`describe-mount-targets`.

**AWS CLI**  
**Untuk menggambarkan target mount**  
`describe-mount-targets`Contoh berikut menjelaskan target mount yang ditentukan.  

```
aws efs describe-mount-targets \
    --mount-target-id fsmt-f9a14450
```
Output:  

```
{
    "MountTargets": [
        {
            "OwnerId": "123456789012",
            "MountTargetId": "fsmt-f9a14450",
            "FileSystemId": "fs-c7a0456e",
            "SubnetId": "subnet-02bf4c428bexample",
            "LifeCycleState": "creating",
            "IpAddress": "10.0.1.24",
            "NetworkInterfaceId": "eni-02d542216aexample",
            "AvailabilityZoneId": "use2-az2",
            "AvailabilityZoneName": "us-east-2b",
            "VpcId": "vpc-0123456789abcdef0"
        }
    ]
}
```
Untuk informasi selengkapnya, lihat [Membuat target mount](https://docs.aws.amazon.com/efs/latest/ug/accessing-fs.html) di *Panduan Pengguna Amazon Elastic File System*.  
+  Untuk detail API, lihat [DescribeMountTargets](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/efs/describe-mount-targets.html)di *Referensi AWS CLI Perintah*. 

### `describe-tags`
<a name="efs_DescribeTags_cli_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`describe-tags`.

**AWS CLI**  
**Untuk menggambarkan tag untuk sistem file**  
`describe-tags`Contoh berikut menjelaskan tag untuk sistem file yang ditentukan.  

```
aws efs describe-tags \
    --file-system-id fs-c7a0456e
```
Output:  

```
{
    "Tags": [
        {
            "Key": "Name",
            "Value": "my-file-system"
        },
        {
            "Key": "Department",
            "Value": "Business Intelligence"
        }
    ]
}
```
Untuk informasi selengkapnya, lihat [Mengelola tag sistem file](https://docs.aws.amazon.com/efs/latest/ug/manage-fs-tags.html) di *Panduan Pengguna Amazon Elastic File System*.  
+  Untuk detail API, lihat [DescribeTags](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/efs/describe-tags.html)di *Referensi AWS CLI Perintah*. 

### `list-tags-for-resource`
<a name="efs_ListTagsForResource_cli_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`list-tags-for-resource`.

**AWS CLI**  
**Untuk mengambil tag untuk sumber daya**  
`list-tags-for-resource`Contoh berikut mengambil tag yang terkait dengan sistem file tertentu.  

```
aws efs list-tags-for-resource \
    --resource-id fs-c7a0456e
```
Output:  

```
{
    "Tags": [
        {
            "Key": "Name",
            "Value": "my-file-system"
        },
        {
            "Key": "Department",
            "Value": "Business Intelligence"
        }
    ]
}
```
Untuk informasi selengkapnya, lihat [Mengelola tag sistem file](https://docs.aws.amazon.com/efs/latest/ug/manage-fs-tags.html) di *Panduan Pengguna Amazon Elastic File System*.  
+  Untuk detail API, lihat [ListTagsForResource](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/efs/list-tags-for-resource.html)di *Referensi AWS CLI Perintah*. 

### `tag-resource`
<a name="efs_TagResource_cli_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`tag-resource`.

**AWS CLI**  
**Untuk menandai sumber daya**  
`tag-resource`Contoh berikut menambahkan tag `Department=Business Intelligence` ke sistem file yang ditentukan.  

```
aws efs tag-resource \
    --resource-id fs-c7a0456e \
    --tags Key=Department,Value="Business Intelligence"
```
Perintah ini tidak menghasilkan output.  
Untuk informasi selengkapnya, lihat [Mengelola tag sistem file](https://docs.aws.amazon.com/efs/latest/ug/manage-fs-tags.html) di *Panduan Pengguna Amazon Elastic File System*.  
+  Untuk detail API, lihat [TagResource](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/efs/tag-resource.html)di *Referensi AWS CLI Perintah*. 

### `untag-resource`
<a name="efs_UntagResource_cli_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`untag-resource`.

**AWS CLI**  
**Untuk menghapus tag dari sumber daya**  
`untag-resource`Contoh berikut menghapus tag dengan kunci `Department` tag dari sistem file yang ditentukan.  

```
aws efs untag-resource \
    --resource-id fs-c7a0456e \
    --tag-keys Department
```
Perintah ini tidak menghasilkan output.  
Untuk informasi selengkapnya, lihat [Mengelola tag sistem file](https://docs.aws.amazon.com/efs/latest/ug/manage-fs-tags.html) di *Panduan Pengguna Amazon Elastic File System*.  
+  Untuk detail API, lihat [UntagResource](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/efs/untag-resource.html)di *Referensi AWS CLI Perintah*. 