Ada lebih banyak contoh AWS SDK yang tersedia di repo Contoh SDK AWS Doc
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
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.
Topik
Tindakan
Contoh kode berikut menunjukkan cara menggunakancreate-file-system.
- AWS CLI
-
Untuk membuat sistem file terenkripsi
create-file-systemContoh berikut membuat sistem file terenkripsi menggunakan CMK default. Itu juga menambahkan tagName=my-file-system.aws efs create-file-system \ --performance-modegeneralPurpose\ --throughput-modebursting\ --encrypted \ --tagsKey=Name,Value=my-file-systemOutput:
{ "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 di Panduan Pengguna Amazon Elastic File System.
-
Untuk detail API, lihat CreateFileSystem
di Referensi AWS CLI Perintah.
-
Contoh kode berikut menunjukkan cara menggunakancreate-mount-target.
- AWS CLI
-
Untuk membuat target mount
create-mount-targetContoh berikut membuat target mount untuk sistem file yang ditentukan.aws efs create-mount-target \ --file-system-idfs-c7a0456e\ --subnet-idsubnet-02bf4c428bexample\ --security-groupssg-068f739363exampleOutput:
{ "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 di Panduan Pengguna Amazon Elastic File System.
-
Untuk detail API, lihat CreateMountTarget
di Referensi AWS CLI Perintah.
-
Contoh kode berikut menunjukkan cara menggunakandelete-file-system.
- AWS CLI
-
Untuk menghapus sistem file
delete-file-systemContoh berikut menghapus sistem file yang ditentukan.aws efs delete-file-system \ --file-system-idfs-c7a0456ePerintah ini tidak menghasilkan output.
Untuk informasi selengkapnya, lihat Menghapus sistem file Amazon EFS di Panduan Pengguna Amazon Elastic File System.
-
Untuk detail API, lihat DeleteFileSystem
di Referensi AWS CLI Perintah.
-
Contoh kode berikut menunjukkan cara menggunakandelete-mount-target.
- AWS CLI
-
Untuk menghapus target pemasangan
delete-mount-targetContoh berikut menghapus target mount yang ditentukan.aws efs delete-mount-target \ --mount-target-idfsmt-f9a14450Perintah ini tidak menghasilkan output.
Untuk informasi selengkapnya, lihat Membuat target mount di Panduan Pengguna Amazon Elastic File System.
-
Untuk detail API, lihat DeleteMountTarget
di Referensi AWS CLI Perintah.
-
Contoh kode berikut menunjukkan cara menggunakandescribe-file-systems.
- AWS CLI
-
Untuk mendeskripsikan sistem file
describe-file-systemsContoh berikut menjelaskan sistem file yang ditentukan.aws efs describe-file-systems \ --file-system-idfs-c7a0456eOutput:
{ "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 di Panduan Pengguna Amazon Elastic File System.
-
Untuk detail API, lihat DescribeFileSystems
di Referensi AWS CLI Perintah.
-
Contoh kode berikut menunjukkan cara menggunakandescribe-mount-targets.
- AWS CLI
-
Untuk menggambarkan target mount
describe-mount-targetsContoh berikut menjelaskan target mount yang ditentukan.aws efs describe-mount-targets \ --mount-target-idfsmt-f9a14450Output:
{ "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 di Panduan Pengguna Amazon Elastic File System.
-
Untuk detail API, lihat DescribeMountTargets
di Referensi AWS CLI Perintah.
-
Contoh kode berikut menunjukkan cara menggunakandescribe-tags.
- AWS CLI
-
Untuk mendeskripsikan tag untuk sistem file
describe-tagsContoh berikut menjelaskan tag untuk sistem file yang ditentukan.aws efs describe-tags \ --file-system-idfs-c7a0456eOutput:
{ "Tags": [ { "Key": "Name", "Value": "my-file-system" }, { "Key": "Department", "Value": "Business Intelligence" } ] }Untuk informasi selengkapnya, lihat Mengelola tag sistem file di Panduan Pengguna Amazon Elastic File System.
-
Untuk detail API, lihat DescribeTags
di Referensi AWS CLI Perintah.
-
Contoh kode berikut menunjukkan cara menggunakanlist-tags-for-resource.
- AWS CLI
-
Untuk mengambil tag untuk sumber daya
list-tags-for-resourceContoh berikut mengambil tag yang terkait dengan sistem file tertentu.aws efs list-tags-for-resource \ --resource-idfs-c7a0456eOutput:
{ "Tags": [ { "Key": "Name", "Value": "my-file-system" }, { "Key": "Department", "Value": "Business Intelligence" } ] }Untuk informasi selengkapnya, lihat Mengelola tag sistem file di Panduan Pengguna Amazon Elastic File System.
-
Untuk detail API, lihat ListTagsForResource
di Referensi AWS CLI Perintah.
-
Contoh kode berikut menunjukkan cara menggunakantag-resource.
- AWS CLI
-
Untuk menandai sumber daya
tag-resourceContoh berikut menambahkan tagDepartment=Business Intelligenceke sistem file yang ditentukan.aws efs tag-resource \ --resource-idfs-c7a0456e\ --tags Key=Department,Value="Business Intelligence"Perintah ini tidak menghasilkan output.
Untuk informasi selengkapnya, lihat Mengelola tag sistem file di Panduan Pengguna Amazon Elastic File System.
-
Untuk detail API, lihat TagResource
di Referensi AWS CLI Perintah.
-
Contoh kode berikut menunjukkan cara menggunakanuntag-resource.
- AWS CLI
-
Untuk menghapus tag dari sumber daya
untag-resourceContoh berikut menghapus tag dengan kunciDepartmenttag dari sistem file yang ditentukan.aws efs untag-resource \ --resource-idfs-c7a0456e\ --tag-keysDepartmentPerintah ini tidak menghasilkan output.
Untuk informasi selengkapnya, lihat Mengelola tag sistem file di Panduan Pengguna Amazon Elastic File System.
-
Untuk detail API, lihat UntagResource
di Referensi AWS CLI Perintah.
-