

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

# Contoh IAM Access Analyzer menggunakan AWS CLI
<a name="cli_accessanalyzer_code_examples"></a>

Contoh kode berikut menunjukkan cara melakukan tindakan dan mengimplementasikan skenario umum dengan menggunakan AWS Command Line Interface dengan IAM Access Analyzer.

*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>

### `apply-archive-rule`
<a name="accessanalyzer_ApplyArchiveRule_cli_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`apply-archive-rule`.

**AWS CLI**  
**Untuk menerapkan aturan arsip pada temuan yang ada yang memenuhi kriteria aturan arsip**  
`apply-archive-rule`Contoh berikut menerapkan aturan arsip untuk temuan yang ada yang memenuhi kriteria aturan arsip.  

```
aws accessanalyzer apply-archive-rule \
    --analyzer-arn {{arn:aws:access-analyzer:us-west-2:111122223333:analyzer/UnusedAccess-ConsoleAnalyzer-organization}} \
    --rule-name {{MyArchiveRule}}
```
Perintah ini tidak menghasilkan output.  
Untuk informasi selengkapnya, lihat [Aturan arsip](https://docs.aws.amazon.com/IAM/latest/UserGuide/access-analyzer-archive-rules.html) di *Panduan Pengguna AWS IAM*.  
+  Untuk detail API, lihat [ApplyArchiveRule](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/accessanalyzer/apply-archive-rule.html)di *Referensi AWS CLI Perintah*. 

### `cancel-policy-generation`
<a name="accessanalyzer_CancelPolicyGeneration_cli_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`cancel-policy-generation`.

**AWS CLI**  
**Untuk membatalkan pembuatan kebijakan yang diminta**  
`cancel-policy-generation`Contoh berikut membatalkan id pekerjaan pembuatan kebijakan yang diminta.  

```
aws accessanalyzer cancel-policy-generation \
    --job-id {{923a56b0-ebb8-4e80-8a3c-a11ccfbcd6f2}}
```
Perintah ini tidak menghasilkan output.  
Untuk informasi selengkapnya, lihat [pembuatan kebijakan IAM Access Analyzer](https://docs.aws.amazon.com/IAM/latest/UserGuide/access-analyzer-policy-generation.html) di Panduan Pengguna *AWS IAM*.  
+  Untuk detail API, lihat [CancelPolicyGeneration](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/accessanalyzer/cancel-policy-generation.html)di *Referensi AWS CLI Perintah*. 

### `check-access-not-granted`
<a name="accessanalyzer_CheckAccessNotGranted_cli_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`check-access-not-granted`.

**AWS CLI**  
**Untuk memeriksa apakah akses yang ditentukan tidak diizinkan oleh kebijakan**  
`check-access-not-granted`Contoh berikut memeriksa apakah akses yang ditentukan tidak diizinkan oleh kebijakan.  

```
aws accessanalyzer check-access-not-granted \
    --policy-document {{file://myfile.json}} \
    --access actions="s3:DeleteBucket","s3:GetBucketLocation" \
    --policy-type {{IDENTITY_POLICY}}
```
Isi dari `myfile.json`:  

```
{
    "Version":"2012-10-17",		 	 	 
    "Statement": [
        {
            "Effect": "Allow",
            "Action": [
                "s3:GetObject",
                "s3:ListBucket"
            ],
            "Resource": [
                "arn:aws:s3:::amzn-s3-demo-bucket",
                "arn:aws:s3:::amzn-s3-demo-bucket/*"
            ]
        }
    ]
}
```
Output:  

```
{
    "result": "PASS",
    "message": "The policy document does not grant access to perform one or more of the listed actions."
}
```
Untuk informasi selengkapnya, lihat [Mempratinjau akses dengan IAM Access Analyzer APIs di Panduan](https://docs.aws.amazon.com/IAM/latest/UserGuide/access-analyzer-preview-access-apis.html) Pengguna *AWS IAM*.  
+  Untuk detail API, lihat [CheckAccessNotGranted](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/accessanalyzer/check-access-not-granted.html)di *Referensi AWS CLI Perintah*. 

### `check-no-new-access`
<a name="accessanalyzer_CheckNoNewAccess_cli_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`check-no-new-access`.

**AWS CLI**  
**Untuk memeriksa apakah akses baru diizinkan untuk kebijakan yang diperbarui jika dibandingkan dengan kebijakan yang ada**  
`check-no-new-access`Contoh berikut memeriksa apakah akses baru diizinkan untuk kebijakan yang diperbarui jika dibandingkan dengan kebijakan yang ada.  

```
aws accessanalyzer check-no-new-access \
    --existing-policy-document {{file://existing-policy.json}} \
    --new-policy-document {{file://new-policy.json}} \
    --policy-type {{IDENTITY_POLICY}}
```
Isi dari `existing-policy.json`:  

```
{
    "Version":"2012-10-17",		 	 	 
    "Statement": [
        {
            "Effect": "Allow",
            "Action": [
                "s3:GetObject",
                "s3:ListBucket"
            ],
            "Resource": [
                "arn:aws:s3:::amzn-s3-demo-bucket",
                "arn:aws:s3:::amzn-s3-demo-bucket/*"
            ]
        }
    ]
}
```
Isi dari `new-policy.json`:  

```
{
    "Version":"2012-10-17",		 	 	 
    "Statement": [
        {
            "Effect": "Allow",
            "Action": [
                "s3:GetObject",
                "s3:GetObjectAcl",
                "s3:ListBucket"
            ],
            "Resource": [
                "arn:aws:s3:::amzn-s3-demo-bucket",
                "arn:aws:s3:::amzn-s3-demo-bucket/*"
            ]
        }
    ]
}
```
Output:  

```
{
    "result": "FAIL",
    "message": "The modified permissions grant new access compared to your existing policy.",
    "reasons": [
        {
            "description": "New access in the statement with index: 0.",
            "statementIndex": 0
        }
    ]
}
```
Untuk informasi selengkapnya, lihat [Mempratinjau akses dengan IAM Access Analyzer APIs di Panduan](https://docs.aws.amazon.com/IAM/latest/UserGuide/access-analyzer-preview-access-apis.html) Pengguna *AWS IAM*.  
+  Untuk detail API, lihat [CheckNoNewAccess](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/accessanalyzer/check-no-new-access.html)di *Referensi AWS CLI Perintah*. 

### `check-no-public-access`
<a name="accessanalyzer_CheckNoPublicAccess_cli_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`check-no-public-access`.

**AWS CLI**  
**Untuk memeriksa apakah kebijakan sumber daya dapat memberikan akses publik ke jenis sumber daya yang ditentukan**  
`check-no-public-access`Contoh berikut memeriksa apakah kebijakan sumber daya dapat memberikan akses publik ke jenis sumber daya yang ditentukan.  

```
aws accessanalyzer check-no-public-access \
    --policy-document {{file://check-no-public-access-myfile.json}} \
    --resource-type {{AWS::S3::Bucket}}
```
Isi dari `myfile.json`:  

```
{
    "Version":"2012-10-17",		 	 	 
    "Statement": [
        {
            "Sid": "CheckNoPublicAccess",
            "Effect": "Allow",
            "Principal": { "AWS": "arn:aws:iam::111122223333:user/JohnDoe" },
            "Action": [
                "s3:GetObject"
            ]
        }
    ]
}
```
Output:  

```
{
    "result": "PASS",
    "message": "The resource policy does not grant public access for the given resource type."
}
```
Untuk informasi selengkapnya, lihat [Mempratinjau akses dengan IAM Access Analyzer APIs di Panduan](https://docs.aws.amazon.com/IAM/latest/UserGuide/access-analyzer-preview-access-apis.html) Pengguna *AWS IAM*.  
+  Untuk detail API, lihat [CheckNoPublicAccess](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/accessanalyzer/check-no-public-access.html)di *Referensi AWS CLI Perintah*. 

### `create-access-preview`
<a name="accessanalyzer_CreateAccessPreview_cli_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`create-access-preview`.

**AWS CLI**  
**Untuk membuat pratinjau akses yang memungkinkan Anda melihat pratinjau temuan IAM Access Analyzer untuk sumber daya Anda sebelum menerapkan izin sumber daya**  
`create-access-preview`Contoh berikut membuat pratinjau akses yang memungkinkan Anda melihat pratinjau temuan IAM Access Analyzer untuk sumber daya Anda sebelum menerapkan izin sumber daya di akun Anda. AWS   

```
aws accessanalyzer create-access-preview \
    --analyzer-arn {{arn:aws:access-analyzer:us-west-2:111122223333:analyzer/ConsoleAnalyzer-account}} \
    --configurations {{file://myfile.json}}
```
Isi dari `myfile.json`:  

```
{
    "arn:aws:s3:::amzn-s3-demo-bucket": {
        "s3Bucket": {
            "bucketPolicy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Effect\":\"Allow\",\"Principal\":{\"AWS\":[\"arn:aws:iam::111122223333:root\"]},\"Action\":[\"s3:PutObject\",\"s3:PutObjectAcl\"],\"Resource\":\"arn:aws:s3:::amzn-s3-demo-bucket/*\"}]}",
            "bucketPublicAccessBlock": {
                "ignorePublicAcls": true,
                "restrictPublicBuckets": true
            },
            "bucketAclGrants": [
                {
                    "grantee": {
                        "id": "79a59df900b949e55d96a1e698fbacedfd6e09d98eacf8f8d5218e7cd47ef2be"
                    },
                    "permission": "READ"
                }
            ]
        }
    }
}
```
Output:  

```
{
    "id": "3c65eb13-6ef9-4629-8919-a32043619e6b"
}
```
Untuk informasi selengkapnya, lihat [Mempratinjau akses dengan IAM Access Analyzer APIs di Panduan](https://docs.aws.amazon.com/IAM/latest/UserGuide/access-analyzer-preview-access-apis.html) Pengguna *AWS IAM*.  
+  Untuk detail API, lihat [CreateAccessPreview](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/accessanalyzer/create-access-preview.html)di *Referensi AWS CLI Perintah*. 

### `create-analyzer`
<a name="accessanalyzer_CreateAnalyzer_cli_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`create-analyzer`.

**AWS CLI**  
**Untuk membuat analyzer**  
`create-analyzer`Contoh berikut membuat analyzer di AWS akun Anda.  

```
aws accessanalyzer create-analyzer \
    --analyzer-name {{example}} \
    --type {{ACCOUNT}}
```
Output:  

```
{
    "arn": "arn:aws:access-analyzer:us-east-2:111122223333:analyzer/example"
}
```
Untuk informasi selengkapnya, lihat [Memulai temuan AWS Identity and Access Management Access Analyzer](https://docs.aws.amazon.com/IAM/latest/UserGuide/access-analyzer-getting-started.html) di *Panduan Pengguna AWS IAM*.  
+  Untuk detail API, lihat [CreateAnalyzer](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/accessanalyzer/create-analyzer.html)di *Referensi AWS CLI Perintah*. 

### `create-archive-rule`
<a name="accessanalyzer_CreateArchiveRule_cli_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`create-archive-rule`.

**AWS CLI**  
**Untuk membuat aturan arsip untuk analyzer yang ditentukan**  
`create-archive-rule`Contoh berikut membuat aturan arsip untuk analyzer yang ditentukan di AWS akun Anda.  

```
aws accessanalyzer create-archive-rule \
    --analyzer-name {{UnusedAccess-ConsoleAnalyzer-organization}} \
    --rule-name {{MyRule}} \
    --filter '{{{"resource": {"contains": ["Cognito"]}, "resourceType": {"eq": ["AWS::IAM::Role"]}}}}'
```
Perintah ini tidak menghasilkan output.  
Untuk informasi selengkapnya, lihat [Aturan arsip](https://docs.aws.amazon.com/IAM/latest/UserGuide/access-analyzer-archive-rules.html) di *Panduan Pengguna AWS IAM*.  
+  Untuk detail API, lihat [CreateArchiveRule](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/accessanalyzer/create-archive-rule.html)di *Referensi AWS CLI Perintah*. 

### `delete-analyzer`
<a name="accessanalyzer_DeleteAnalyzer_cli_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`delete-analyzer`.

**AWS CLI**  
**Untuk menghapus analyzer yang ditentukan**  
`delete-analyzer`Contoh berikut menghapus analyzer yang ditentukan di akun Anda AWS .  

```
aws accessanalyzer delete-analyzer \
    --analyzer-name {{example}}
```
Perintah ini tidak menghasilkan output.  
Untuk informasi selengkapnya, lihat [Aturan arsip](https://docs.aws.amazon.com/IAM/latest/UserGuide/access-analyzer-archive-rules.html) di *Panduan Pengguna AWS IAM*.  
+  Untuk detail API, lihat [DeleteAnalyzer](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/accessanalyzer/delete-analyzer.html)di *Referensi AWS CLI Perintah*. 

### `delete-archive-rule`
<a name="accessanalyzer_DeleteArchiveRule_cli_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`delete-archive-rule`.

**AWS CLI**  
**Untuk menghapus aturan arsip yang ditentukan**  
`delete-archive-rule`Contoh berikut menghapus aturan arsip yang ditentukan di AWS akun Anda.  

```
aws accessanalyzer delete-archive-rule \
    --analyzer-name {{UnusedAccess-ConsoleAnalyzer-organization}} \
    --rule-name {{MyRule}}
```
Perintah ini tidak menghasilkan output.  
Untuk informasi selengkapnya, lihat [Aturan arsip](https://docs.aws.amazon.com/IAM/latest/UserGuide/access-analyzer-archive-rules.html) di *Panduan Pengguna AWS IAM*.  
+  Untuk detail API, lihat [DeleteArchiveRule](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/accessanalyzer/delete-archive-rule.html)di *Referensi AWS CLI Perintah*. 

### `get-access-preview`
<a name="accessanalyzer_GetAccessPreview_cli_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`get-access-preview`.

**AWS CLI**  
**Untuk mengambil informasi tentang pratinjau akses untuk penganalisis yang ditentukan**  
`get-access-preview`Contoh berikut mengambil informasi tentang pratinjau akses untuk penganalisis yang ditentukan di akun Anda AWS .  

```
aws accessanalyzer get-access-preview \
    --access-preview-id {{3c65eb13-6ef9-4629-8919-a32043619e6b}} \
    --analyzer-arn {{arn:aws:access-analyzer:us-west-2:111122223333:analyzer/ConsoleAnalyzer-account}}
```
Output:  

```
{
    "accessPreview": {
        "id": "3c65eb13-6ef9-4629-8919-a32043619e6b",
        "analyzerArn": "arn:aws:access-analyzer:us-west-2:111122223333:analyzer/ConsoleAnalyzer-account",
        "configurations": {
            "arn:aws:s3:::amzn-s3-demo-bucket": {
                "s3Bucket": {
                    "bucketPolicy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Effect\":\"Allow\",\"Principal\":{\"AWS\":[\"arn:aws:iam::111122223333:root\"]},\"Action\":[\"s3:PutObject\",\"s3:PutObjectAcl\"],\"Resource\":\"arn:aws:s3:::amzn-s3-demo-bucket/*\"}]}",
                    "bucketAclGrants": [
                        {
                            "permission": "READ",
                            "grantee": {
                                "id": "79a59df900b949e55d96a1e698fbacedfd6e09d98eacf8f8d5218e7cd47ef2be"
                            }
                        }
                    ],
                    "bucketPublicAccessBlock": {
                        "ignorePublicAcls": true,
                        "restrictPublicBuckets": true
                    }
                }
            }
        },
        "createdAt": "2024-02-17T00:18:44+00:00",
        "status": "COMPLETED"
    }
}
```
Untuk informasi selengkapnya, lihat [Mempratinjau akses dengan IAM Access Analyzer APIs di Panduan](https://docs.aws.amazon.com/IAM/latest/UserGuide/access-analyzer-preview-access-apis.html) Pengguna *AWS IAM*.  
+  Untuk detail API, lihat [GetAccessPreview](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/accessanalyzer/get-access-preview.html)di *Referensi AWS CLI Perintah*. 

### `get-analyzed-resource`
<a name="accessanalyzer_GetAnalyzedResource_cli_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`get-analyzed-resource`.

**AWS CLI**  
**Untuk mengambil informasi tentang sumber daya yang dianalisis**  
`get-analyzed-resource`Contoh berikut mengambil informasi tentang sumber daya yang dianalisis di AWS akun Anda.  

```
aws accessanalyzer get-analyzed-resource \
    --analyzer-arn {{arn:aws:access-analyzer:us-west-2:111122223333:analyzer/ConsoleAnalyzer-account}} \
    --resource-arn {{arn:aws:s3:::amzn-s3-demo-bucket}}
```
Output:  

```
{
    "resource": {
        "analyzedAt": "2024-02-15T18:01:53.002000+00:00",
        "isPublic": false,
        "resourceArn": "arn:aws:s3:::amzn-s3-demo-bucket",
        "resourceOwnerAccount": "111122223333",
        "resourceType": "AWS::S3::Bucket"
    }
}
```
Untuk informasi selengkapnya, lihat [Menggunakan AWS Identity and Access Management Access Analyzer](https://docs.aws.amazon.com/IAM/latest/UserGuide/what-is-access-analyzer.html) di *Panduan Pengguna AWS IAM*.  
+  Untuk detail API, lihat [GetAnalyzedResource](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/accessanalyzer/get-analyzed-resource.html)di *Referensi AWS CLI Perintah*. 

### `get-analyzer`
<a name="accessanalyzer_GetAnalyzer_cli_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`get-analyzer`.

**AWS CLI**  
**Untuk mengambil informasi tentang analyzer yang ditentukan**  
`get-analyzer`Contoh berikut mengambil informasi tentang analyzer yang ditentukan di akun Anda AWS .  

```
aws accessanalyzer get-analyzer \
    --analyzer-name {{ConsoleAnalyzer-account}}
```
Output:  

```
{
    "analyzer": {
        "arn": "arn:aws:access-analyzer:us-west-2:111122223333:analyzer/ConsoleAnalyzer-account",
        "createdAt": "2019-12-03T07:28:17+00:00",
        "lastResourceAnalyzed": "arn:aws:sns:us-west-2:111122223333:config-topic",
        "lastResourceAnalyzedAt": "2024-02-15T18:01:53.003000+00:00",
        "name": "ConsoleAnalyzer-account",
        "status": "ACTIVE",
        "tags": {
            "auto-delete": "no"
        },
        "type": "ACCOUNT"
    }
}
```
Untuk informasi selengkapnya, lihat [Menggunakan AWS Identity and Access Management Access Analyzer](https://docs.aws.amazon.com/IAM/latest/UserGuide/what-is-access-analyzer.html) di *Panduan Pengguna AWS IAM*.  
+  Untuk detail API, lihat [GetAnalyzer](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/accessanalyzer/get-analyzer.html)di *Referensi AWS CLI Perintah*. 

### `get-archive-rule`
<a name="accessanalyzer_GetArchiveRule_cli_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`get-archive-rule`.

**AWS CLI**  
**Untuk mengambil informasi tentang aturan arsip**  
`get-archive-rule`Contoh berikut mengambil informasi tentang aturan arsip di AWS akun Anda.  

```
aws accessanalyzer get-archive-rule \
    --analyzer-name {{UnusedAccess-ConsoleAnalyzer-organization}} \
    --rule-name {{MyArchiveRule}}
```
Output:  

```
{
    "archiveRule": {
        "createdAt": "2024-02-15T00:49:27+00:00",
        "filter": {
            "resource": {
                "contains": [
                    "Cognito"
                ]
            },
            "resourceType": {
                "eq": [
                    "AWS::IAM::Role"
                ]
            }
        },
        "ruleName": "MyArchiveRule",
        "updatedAt": "2024-02-15T00:49:27+00:00"
    }
}
```
Untuk informasi selengkapnya, lihat [Aturan arsip](https://docs.aws.amazon.com/IAM/latest/UserGuide/access-analyzer-archive-rules.html) di *Panduan Pengguna AWS IAM*.  
+  Untuk detail API, lihat [GetArchiveRule](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/accessanalyzer/get-archive-rule.html)di *Referensi AWS CLI Perintah*. 

### `get-finding-v2`
<a name="accessanalyzer_GetFindingV2_cli_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`get-finding-v2`.

**AWS CLI**  
**Untuk mengambil informasi tentang temuan yang ditentukan**  
`get-finding-v2`Contoh berikut etrieves informasi tentang temuan yang ditentukan di akun Anda AWS .  

```
aws accessanalyzer get-finding-v2 \
    --analyzer-arn {{arn:aws:access-analyzer:us-west-2:111122223333:analyzer/ConsoleAnalyzer-organization}} \
    --id {{0910eedb-381e-4e95-adda-0d25c19e6e90}}
```
Output:  

```
{
    "findingDetails": [
        {
            "externalAccessDetails": {
                "action": [
                    "sts:AssumeRoleWithWebIdentity"
                ],
                "condition": {
                    "cognito-identity.amazonaws.com:aud": "us-west-2:EXAMPLE0-0000-0000-0000-000000000000"
                },
                "isPublic": false,
                "principal": {
                    "Federated": "cognito-identity.amazonaws.com"
                }
            }
        }
    ],
    "resource": "arn:aws:iam::111122223333:role/Cognito_testpoolAuth_Role",
    "status": "ACTIVE",
    "error": null,
    "createdAt": "2021-02-26T21:17:50.905000+00:00",
    "resourceType": "AWS::IAM::Role",
    "findingType": "ExternalAccess",
    "resourceOwnerAccount": "111122223333",
    "analyzedAt": "2024-02-16T18:17:47.888000+00:00",
    "id": "0910eedb-381e-4e95-adda-0d25c19e6e90",
    "updatedAt": "2021-02-26T21:17:50.905000+00:00"
}
```
Untuk informasi selengkapnya, lihat [Meninjau temuan](https://docs.aws.amazon.com/IAM/latest/UserGuide/access-analyzer-findings-view.html) di *Panduan Pengguna AWS IAM*.  
+  Untuk detail API, lihat [GetFindingV2](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/accessanalyzer/get-finding-v2.html) di *Referensi AWS CLI Perintah*. 

### `get-finding`
<a name="accessanalyzer_GetFinding_cli_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`get-finding`.

**AWS CLI**  
**Untuk mengambil informasi tentang temuan yang ditentukan**  
`get-finding`Contoh berikut etrieves informasi tentang temuan yang ditentukan di akun Anda AWS .  

```
aws accessanalyzer get-finding \
    --analyzer-arn {{arn:aws:access-analyzer:us-west-2:111122223333:analyzer/ConsoleAnalyzer-organization}} \
    --id {{0910eedb-381e-4e95-adda-0d25c19e6e90}}
```
Output:  

```
{
    "finding": {
        "id": "0910eedb-381e-4e95-adda-0d25c19e6e90",
        "principal": {
            "Federated": "cognito-identity.amazonaws.com"
        },
        "action": [
            "sts:AssumeRoleWithWebIdentity"
        ],
        "resource": "arn:aws:iam::111122223333:role/Cognito_testpoolAuth_Role",
        "isPublic": false,
        "resourceType": "AWS::IAM::Role",
        "condition": {
            "cognito-identity.amazonaws.com:aud": "us-west-2:EXAMPLE0-0000-0000-0000-000000000000"
        },
        "createdAt": "2021-02-26T21:17:50.905000+00:00",
        "analyzedAt": "2024-02-16T18:17:47.888000+00:00",
        "updatedAt": "2021-02-26T21:17:50.905000+00:00",
        "status": "ACTIVE",
        "resourceOwnerAccount": "111122223333"
    }
}
```
Untuk informasi selengkapnya, lihat [Meninjau temuan](https://docs.aws.amazon.com/IAM/latest/UserGuide/access-analyzer-findings-view.html) di *Panduan Pengguna AWS IAM*.  
+  Untuk detail API, lihat [GetFinding](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/accessanalyzer/get-finding.html)di *Referensi AWS CLI Perintah*. 

### `get-generated-policy`
<a name="accessanalyzer_GetGeneratedPolicy_cli_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`get-generated-policy`.

**AWS CLI**  
**Untuk mengambil kebijakan yang dibuat menggunakan `StartPolicyGeneration` API**  
`get-generated-policy`Contoh berikut mengambil kebijakan yang dibuat menggunakan StartPolicyGeneration API di AWS akun Anda.  

```
aws accessanalyzer get-generated-policy \
    --job-id {{c557dc4a-0338-4489-95dd-739014860ff9}}
```
Output:  

```
{
    "generatedPolicyResult": {
        "generatedPolicies": [
            {
                "policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Sid\":\"SupportedServiceSid0\",\"Effect\":\"Allow\",\"Action\":[\"access-analyzer:GetAnalyzer\",\"access-analyzer:ListAnalyzers\",\"access-analyzer:ListArchiveRules\",\"access-analyzer:ListFindings\",\"cloudtrail:DescribeTrails\",\"cloudtrail:GetEventDataStore\",\"cloudtrail:GetEventSelectors\",\"cloudtrail:GetInsightSelectors\",\"cloudtrail:GetTrailStatus\",\"cloudtrail:ListChannels\",\"cloudtrail:ListEventDataStores\",\"cloudtrail:ListQueries\",\"cloudtrail:ListTags\",\"cloudtrail:LookupEvents\",\"ec2:DescribeRegions\",\"iam:GetAccountSummary\",\"iam:GetOpenIDConnectProvider\",\"iam:GetRole\",\"iam:ListAccessKeys\",\"iam:ListAccountAliases\",\"iam:ListOpenIDConnectProviders\",\"iam:ListRoles\",\"iam:ListSAMLProviders\",\"kms:ListAliases\",\"s3:GetBucketLocation\",\"s3:ListAllMyBuckets\"],\"Resource\":\"*\"}]}"
            }
        ],
        "properties": {
            "cloudTrailProperties": {
                "endTime": "2024-02-14T22:44:40+00:00",
                "startTime": "2024-02-13T00:30:00+00:00",
                "trailProperties": [
                    {
                        "allRegions": true,
                        "cloudTrailArn": "arn:aws:cloudtrail:us-west-2:111122223333:trail/my-trail",
                        "regions": []
                    }
                ]
            },
            "isComplete": false,
            "principalArn": "arn:aws:iam::111122223333:role/Admin"
        }
    },
    "jobDetails": {
        "completedOn": "2024-02-14T22:47:01+00:00",
        "jobId": "c557dc4a-0338-4489-95dd-739014860ff9",
        "startedOn": "2024-02-14T22:44:41+00:00",
        "status": "SUCCEEDED"
    }
}
```
Untuk informasi selengkapnya, lihat [pembuatan kebijakan IAM Access Analyzer](https://docs.aws.amazon.com/IAM/latest/UserGuide/access-analyzer-policy-generation.html) di Panduan Pengguna *AWS IAM*.  
+  Untuk detail API, lihat [GetGeneratedPolicy](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/accessanalyzer/get-generated-policy.html)di *Referensi AWS CLI Perintah*. 

### `list-access-preview-findings`
<a name="accessanalyzer_ListAccessPreviewFindings_cli_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`list-access-preview-findings`.

**AWS CLI**  
**Untuk mengambil daftar temuan pratinjau akses yang dihasilkan oleh pratinjau akses yang ditentukan**  
`list-access-preview-findings`Contoh berikut mengambil daftar temuan pratinjau akses yang dihasilkan oleh pratinjau akses yang ditentukan di AWS akun Anda.  

```
aws accessanalyzer list-access-preview-findings \
    --access-preview-id {{3c65eb13-6ef9-4629-8919-a32043619e6b}} \
    --analyzer-arn {{arn:aws:access-analyzer:us-west-2:111122223333:analyzer/ConsoleAnalyzer-account}}
```
Output:  

```
{
    "findings": [
        {
            "id": "e22fc158-1c87-4c32-9464-e7f405ce8d74",
            "principal": {
                "AWS": "111122223333"
            },
            "action": [
                "s3:PutObject",
                "s3:PutObjectAcl"
            ],
            "condition": {},
            "resource": "arn:aws:s3:::amzn-s3-demo-bucket",
            "isPublic": false,
            "resourceType": "AWS::S3::Bucket",
            "createdAt": "2024-02-17T00:18:46+00:00",
            "changeType": "NEW",
            "status": "ACTIVE",
            "resourceOwnerAccount": "111122223333",
            "sources": [
                {
                    "type": "POLICY"
                }
            ]
        }
    ]
}
```
Untuk informasi selengkapnya, lihat [Mempratinjau akses dengan IAM Access Analyzer APIs di Panduan](https://docs.aws.amazon.com/IAM/latest/UserGuide/access-analyzer-preview-access-apis.html) Pengguna *AWS IAM*.  
+  Untuk detail API, lihat [ListAccessPreviewFindings](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/accessanalyzer/list-access-preview-findings.html)di *Referensi AWS CLI Perintah*. 

### `list-access-previews`
<a name="accessanalyzer_ListAccessPreviews_cli_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`list-access-previews`.

**AWS CLI**  
**Untuk mengambil daftar pratinjau akses untuk analyzer yang ditentukan**  
`list-access-previews`Contoh berikut mengambil daftar pratinjau akses untuk analyzer yang ditentukan di akun Anda. AWS   

```
aws accessanalyzer list-access-previews \
    --analyzer-arn {{arn:aws:access-analyzer:us-west-2:111122223333:analyzer/ConsoleAnalyzer-account}}
```
Output:  

```
{
    "accessPreviews": [
        {
            "id": "3c65eb13-6ef9-4629-8919-a32043619e6b",
            "analyzerArn": "arn:aws:access-analyzer:us-west-2:111122223333:analyzer/ConsoleAnalyzer-account",
            "createdAt": "2024-02-17T00:18:44+00:00",
            "status": "COMPLETED"
        }
    ]
}
```
Untuk informasi selengkapnya, lihat [Mempratinjau akses dengan IAM Access Analyzer APIs di Panduan](https://docs.aws.amazon.com/IAM/latest/UserGuide/access-analyzer-preview-access-apis.html) Pengguna *AWS IAM*.  
+  Untuk detail API, lihat [ListAccessPreviews](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/accessanalyzer/list-access-previews.html)di *Referensi AWS CLI Perintah*. 

### `list-analyzed-resources`
<a name="accessanalyzer_ListAnalyzedResources_cli_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`list-analyzed-resources`.

**AWS CLI**  
**Untuk daftar widget yang tersedia**  
`list-analyzed-resources`Contoh berikut mencantumkan widget yang tersedia di AWS akun Anda.  

```
aws accessanalyzer list-analyzed-resources \
    --analyzer-arn {{arn:aws:access-analyzer:us-west-2:111122223333:analyzer/ConsoleAnalyzer-account}} \
    --resource-type {{AWS::IAM::Role}}
```
Output:  

```
{
    "analyzedResources": [
        {
            "resourceArn": "arn:aws:sns:us-west-2:111122223333:Validation-Email",
            "resourceOwnerAccount": "111122223333",
            "resourceType": "AWS::SNS::Topic"
        },
        {
            "resourceArn": "arn:aws:sns:us-west-2:111122223333:admin-alerts",
            "resourceOwnerAccount": "111122223333",
            "resourceType": "AWS::SNS::Topic"
        },
        {
            "resourceArn": "arn:aws:sns:us-west-2:111122223333:config-topic",
            "resourceOwnerAccount": "111122223333",
            "resourceType": "AWS::SNS::Topic"
        },
        {
            "resourceArn": "arn:aws:sns:us-west-2:111122223333:inspector-topic",
            "resourceOwnerAccount": "111122223333",
            "resourceType": "AWS::SNS::Topic"
        }
    ]
}
```
Untuk informasi selengkapnya, lihat [Menggunakan AWS Identity and Access Management Access Analyzer](https://docs.aws.amazon.com/IAM/latest/UserGuide/what-is-access-analyzer.html) di *Panduan Pengguna AWS IAM*.  
+  Untuk detail API, lihat [ListAnalyzedResources](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/accessanalyzer/list-analyzed-resources.html)di *Referensi AWS CLI Perintah*. 

### `list-analyzers`
<a name="accessanalyzer_ListAnalyzers_cli_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`list-analyzers`.

**AWS CLI**  
**Untuk mengambil daftar analisa**  
`list-analyzers`Contoh berikut mengambil daftar analisa di akun Anda AWS .  

```
aws accessanalyzer list-analyzers
```
Output:  

```
{
    "analyzers": [
        {
            "arn": "arn:aws:access-analyzer:us-west-2:111122223333:analyzer/UnusedAccess-ConsoleAnalyzer-organization",
            "createdAt": "2024-02-15T00:46:40+00:00",
            "name": "UnusedAccess-ConsoleAnalyzer-organization",
            "status": "ACTIVE",
            "tags": {
                "auto-delete": "no"
            },
            "type": "ORGANIZATION_UNUSED_ACCESS"
        },
        {
            "arn": "arn:aws:access-analyzer:us-west-2:111122223333:analyzer/ConsoleAnalyzer-organization",
            "createdAt": "2020-04-25T07:43:28+00:00",
            "lastResourceAnalyzed": "arn:aws:s3:::amzn-s3-demo-bucket",
            "lastResourceAnalyzedAt": "2024-02-15T21:51:56.517000+00:00",
            "name": "ConsoleAnalyzer-organization",
            "status": "ACTIVE",
            "tags": {
                "auto-delete": "no"
            },
            "type": "ORGANIZATION"
        },
        {
            "arn": "arn:aws:access-analyzer:us-west-2:111122223333:analyzer/ConsoleAnalyzer-account",
            "createdAt": "2019-12-03T07:28:17+00:00",
            "lastResourceAnalyzed": "arn:aws:sns:us-west-2:111122223333:config-topic",
            "lastResourceAnalyzedAt": "2024-02-15T18:01:53.003000+00:00",
            "name": "ConsoleAnalyzer-account",
            "status": "ACTIVE",
            "tags": {
                "auto-delete": "no"
            },
            "type": "ACCOUNT"
        }
    ]
}
```
Untuk informasi selengkapnya, lihat [Menggunakan AWS Identity and Access Management Access Analyzer](https://docs.aws.amazon.com/IAM/latest/UserGuide/what-is-access-analyzer.html) di *Panduan Pengguna AWS IAM*.  
+  Untuk detail API, lihat [ListAnalyzers](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/accessanalyzer/list-analyzers.html)di *Referensi AWS CLI Perintah*. 

### `list-archive-rules`
<a name="accessanalyzer_ListArchiveRules_cli_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`list-archive-rules`.

**AWS CLI**  
**Untuk mengambil daftar aturan arsip yang dibuat untuk analyzer yang ditentukan**  
`list-archive-rules`Contoh berikut mengambil daftar aturan arsip yang dibuat untuk analyzer yang ditentukan di akun Anda AWS .  

```
aws accessanalyzer list-archive-rules \
    --analyzer-name {{UnusedAccess-ConsoleAnalyzer-organization}}
```
Output:  

```
{
    "archiveRules": [
        {
            "createdAt": "2024-02-15T00:49:27+00:00",
            "filter": {
                "resource": {
                    "contains": [
                        "Cognito"
                    ]
                },
                "resourceType": {
                    "eq": [
                        "AWS::IAM::Role"
                    ]
                }
            },
            "ruleName": "MyArchiveRule",
            "updatedAt": "2024-02-15T00:49:27+00:00"
        },
        {
            "createdAt": "2024-02-15T23:27:45+00:00",
            "filter": {
                "findingType": {
                    "eq": [
                        "UnusedIAMUserAccessKey"
                    ]
                }
            },
            "ruleName": "ArchiveRule-56125a39-e517-4ff8-afb1-ef06f58db612",
            "updatedAt": "2024-02-15T23:27:45+00:00"
        }
    ]
}
```
Untuk informasi selengkapnya, lihat [Menggunakan AWS Identity and Access Management Access Analyzer](https://docs.aws.amazon.com/IAM/latest/UserGuide/what-is-access-analyzer.html) di *Panduan Pengguna AWS IAM*.  
+  Untuk detail API, lihat [ListArchiveRules](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/accessanalyzer/list-archive-rules.html)di *Referensi AWS CLI Perintah*. 

### `list-findings-v2`
<a name="accessanalyzer_ListFindingsV2_cli_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`list-findings-v2`.

**AWS CLI**  
**Untuk mengambil daftar temuan yang dihasilkan oleh penganalisis yang ditentukan**  
`list-findings-v2`Contoh berikut mengambil daftar temuan yang dihasilkan oleh penganalisis yang ditentukan di akun Anda AWS . Contoh ini memfilter hasil untuk menyertakan hanya peran IAM yang namanya berisi`Cognito`.  

```
aws accessanalyzer list-findings-v2 \
    --analyzer-arn {{arn:aws:access-analyzer:us-west-2:111122223333:analyzer/ConsoleAnalyzer-account}} \
    --filter '{{{"resource": {"contains": ["Cognito"]}, "resourceType": {"eq": ["AWS::IAM::Role"]}}}}'
```
Output:  

```
{
    "findings": [
        {
            "analyzedAt": "2024-02-16T18:17:47.888000+00:00",
            "createdAt": "2021-02-26T21:17:24.710000+00:00",
            "id": "597f3bc2-3adc-4c18-9879-5c4b23485e46",
            "resource": "arn:aws:iam::111122223333:role/Cognito_testpoolUnauth_Role",
            "resourceType": "AWS::IAM::Role",
            "resourceOwnerAccount": "111122223333",
            "status": "ACTIVE",
            "updatedAt": "2021-02-26T21:17:24.710000+00:00",
            "findingType": "ExternalAccess"
        },
        {
            "analyzedAt": "2024-02-16T18:17:47.888000+00:00",
            "createdAt": "2021-02-26T21:17:50.905000+00:00",
            "id": "ce0e221a-85b9-4d52-91ff-d7678075442f",
            "resource": "arn:aws:iam::111122223333:role/Cognito_testpoolAuth_Role",
            "resourceType": "AWS::IAM::Role",
            "resourceOwnerAccount": "111122223333",
            "status": "ACTIVE",
            "updatedAt": "2021-02-26T21:17:50.905000+00:00",
            "findingType": "ExternalAccess"
        }
    ]
}
```
Untuk informasi selengkapnya, lihat [Menggunakan AWS Identity and Access Management Access Analyzer](https://docs.aws.amazon.com/IAM/latest/UserGuide/what-is-access-analyzer.html) di *Panduan Pengguna AWS IAM*.  
+  Untuk detail API, lihat [ListFindingsV2](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/accessanalyzer/list-findings-v2.html) di *Referensi AWS CLI Perintah*. 

### `list-findings`
<a name="accessanalyzer_ListFindings_cli_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`list-findings`.

**AWS CLI**  
**Untuk mengambil daftar temuan yang dihasilkan oleh penganalisis yang ditentukan**  
`list-findings`Contoh berikut mengambil daftar temuan yang dihasilkan oleh penganalisis yang ditentukan di akun Anda AWS . Contoh ini memfilter hasil untuk menyertakan hanya peran IAM yang namanya berisi`Cognito`.  

```
aws accessanalyzer list-findings \
    --analyzer-arn {{arn:aws:access-analyzer:us-west-2:111122223333:analyzer/ConsoleAnalyzer-account}} \
    --filter '{{{"resource": {"contains": ["Cognito"]}, "resourceType": {"eq": ["AWS::IAM::Role"]}}}}'
```
Output:  

```
{
    "findings": [
        {
            "id": "597f3bc2-3adc-4c18-9879-5c4b23485e46",
            "principal": {
                "Federated": "cognito-identity.amazonaws.com"
            },
            "action": [
                "sts:AssumeRoleWithWebIdentity"
            ],
            "resource": "arn:aws:iam::111122223333:role/Cognito_testpoolUnauth_Role",
            "isPublic": false,
            "resourceType": "AWS::IAM::Role",
            "condition": {
                "cognito-identity.amazonaws.com:aud": "us-west-2:EXAMPLE0-0000-0000-0000-000000000000"
            },
            "createdAt": "2021-02-26T21:17:24.710000+00:00",
            "analyzedAt": "2024-02-16T18:17:47.888000+00:00",
            "updatedAt": "2021-02-26T21:17:24.710000+00:00",
            "status": "ACTIVE",
            "resourceOwnerAccount": "111122223333"
        },
        {
            "id": "ce0e221a-85b9-4d52-91ff-d7678075442f",
            "principal": {
                "Federated": "cognito-identity.amazonaws.com"
            },
            "action": [
                "sts:AssumeRoleWithWebIdentity"
            ],
            "resource": "arn:aws:iam::111122223333:role/Cognito_testpoolAuth_Role",
            "isPublic": false,
            "resourceType": "AWS::IAM::Role",
            "condition": {
                "cognito-identity.amazonaws.com:aud": "us-west-2:EXAMPLE0-0000-0000-0000-000000000000"
            },
            "createdAt": "2021-02-26T21:17:50.905000+00:00",
            "analyzedAt": "2024-02-16T18:17:47.888000+00:00",
            "updatedAt": "2021-02-26T21:17:50.905000+00:00",
            "status": "ACTIVE",
            "resourceOwnerAccount": "111122223333"
        }
    ]
}
```
Untuk informasi selengkapnya, lihat [Menggunakan AWS Identity and Access Management Access Analyzer](https://docs.aws.amazon.com/IAM/latest/UserGuide/what-is-access-analyzer.html) di *Panduan Pengguna AWS IAM*.  
+  Untuk detail API, lihat [ListFindings](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/accessanalyzer/list-findings.html)di *Referensi AWS CLI Perintah*. 

### `list-policy-generations`
<a name="accessanalyzer_ListPolicyGenerations_cli_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`list-policy-generations`.

**AWS CLI**  
**Untuk membuat daftar semua generasi kebijakan yang diminta dalam tujuh hari terakhir**  
`list-policy-generations`Contoh berikut mencantumkan semua generasi kebijakan yang diminta dalam tujuh hari terakhir di AWS akun Anda.  

```
aws accessanalyzer list-policy-generations
```
Output:  

```
{
    "policyGenerations": [
        {
            "completedOn": "2024-02-14T23:43:38+00:00",
            "jobId": "923a56b0-ebb8-4e80-8a3c-a11ccfbcd6f2",
            "principalArn": "arn:aws:iam::111122223333:role/Admin",
            "startedOn": "2024-02-14T23:43:02+00:00",
            "status": "CANCELED"
        },
        {
            "completedOn": "2024-02-14T22:47:01+00:00",
            "jobId": "c557dc4a-0338-4489-95dd-739014860ff9",
            "principalArn": "arn:aws:iam::111122223333:role/Admin",
            "startedOn": "2024-02-14T22:44:41+00:00",
            "status": "SUCCEEDED"
        }
    ]
}
```
Untuk informasi selengkapnya, lihat [pembuatan kebijakan IAM Access Analyzer](https://docs.aws.amazon.com/IAM/latest/UserGuide/access-analyzer-policy-generation.html) di Panduan Pengguna *AWS IAM*.  
+  Untuk detail API, lihat [ListPolicyGenerations](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/accessanalyzer/list-policy-generations.html)di *Referensi AWS CLI Perintah*. 

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

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

**AWS CLI**  
**Untuk mengambil daftar tag yang diterapkan ke sumber daya yang ditentukan**  
`list-tags-for-resource`Contoh berikut mengambil daftar tag yang diterapkan ke sumber daya yang ditentukan di AWS akun Anda.  

```
aws accessanalyzer list-tags-for-resource \
    --resource-arn {{arn:aws:access-analyzer:us-west-2:111122223333:analyzer/ConsoleAnalyzer-account}}
```
Output:  

```
{
    "tags": {
        "Zone-of-trust": "Account",
        "Name": "ConsoleAnalyzer"
    }
}
```
Untuk informasi selengkapnya, lihat [pembuatan kebijakan IAM Access Analyzer](https://docs.aws.amazon.com/IAM/latest/UserGuide/access-analyzer-policy-generation.html) di Panduan Pengguna *AWS IAM*.  
+  Untuk detail API, lihat [ListTagsForResource](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/accessanalyzer/list-tags-for-resource.html)di *Referensi AWS CLI Perintah*. 

### `start-policy-generation`
<a name="accessanalyzer_StartPolicyGeneration_cli_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`start-policy-generation`.

**AWS CLI**  
**Untuk memulai permintaan pembuatan kebijakan**  
`start-policy-generation`Contoh berikut memulai permintaan pembuatan kebijakan di AWS akun Anda.  

```
aws accessanalyzer start-policy-generation \
    --policy-generation-details '{{{"principalArn":"arn:aws:iam::111122223333:role/Admin"}}}' \
    --cloud-trail-details {{file://myfile.json}}
```
Isi dari `myfile.json`:  

```
{
    "accessRole": "arn:aws:iam::111122223333:role/service-role/AccessAnalyzerMonitorServiceRole",
    "startTime": "2024-02-13T00:30:00Z",
    "trails": [
        {
            "allRegions": true,
            "cloudTrailArn": "arn:aws:cloudtrail:us-west-2:111122223333:trail/my-trail"
        }
    ]
}
```
Output:  

```
{
    "jobId": "c557dc4a-0338-4489-95dd-739014860ff9"
}
```
Untuk informasi selengkapnya, lihat [pembuatan kebijakan IAM Access Analyzer](https://docs.aws.amazon.com/IAM/latest/UserGuide/access-analyzer-policy-generation.html) di Panduan Pengguna *AWS IAM*.  
+  Untuk detail API, lihat [StartPolicyGeneration](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/accessanalyzer/start-policy-generation.html)di *Referensi AWS CLI Perintah*. 

### `start-resource-scan`
<a name="accessanalyzer_StartResourceScan_cli_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`start-resource-scan`.

**AWS CLI**  
**Untuk segera memulai pemindaian kebijakan yang diterapkan ke sumber daya yang ditentukan**  
`start-resource-scan`Contoh berikut mmediately memulai pemindaian kebijakan yang diterapkan ke sumber daya yang ditentukan di akun Anda AWS .  

```
aws accessanalyzer start-resource-scan \
    --analyzer-arn {{arn:aws:access-analyzer:us-west-2:111122223333:analyzer/ConsoleAnalyzer-account}} \
    --resource-arn {{arn:aws:iam::111122223333:role/Cognito_testpoolAuth_Role}}
```
Perintah ini tidak menghasilkan output.  
Untuk informasi selengkapnya, lihat [pembuatan kebijakan IAM Access Analyzer](https://docs.aws.amazon.com/IAM/latest/UserGuide/access-analyzer-policy-generation.html) di Panduan Pengguna *AWS IAM*.  
+  Untuk detail API, lihat [StartResourceScan](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/accessanalyzer/start-resource-scan.html)di *Referensi AWS CLI Perintah*. 

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

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

**AWS CLI**  
**Untuk menambahkan tag ke sumber daya yang ditentukan**  
`tag-resource`Contoh berikut menambahkan tag ke sumber daya yang ditentukan di AWS akun Anda.  

```
aws accessanalyzer tag-resource \
    --resource-arn {{arn:aws:access-analyzer:us-west-2:111122223333:analyzer/ConsoleAnalyzer-account}} \
    --tags {{Environment=dev,Purpose=testing}}
```
Perintah ini tidak menghasilkan output.  
Untuk informasi selengkapnya, lihat [Menggunakan AWS Identity and Access Management Access Analyzer](https://docs.aws.amazon.com/IAM/latest/UserGuide/what-is-access-analyzer.html) di *Panduan Pengguna AWS IAM*.  
+  Untuk detail API, lihat [TagResource](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/accessanalyzer/tag-resource.html)di *Referensi AWS CLI Perintah*. 

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

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

**AWS CLI**  
**Untuk menghapus tag dari sumber daya yang ditentukan**  
`untag-resource`Contoh berikut menghapus tag dari sumber daya yang ditentukan di AWS akun Anda.  

```
aws accessanalyzer untag-resource \
    --resource-arn {{arn:aws:access-analyzer:us-west-2:111122223333:analyzer/ConsoleAnalyzer-account}} \
    --tag-keys {{Environment}} {{Purpose}}
```
Perintah ini tidak menghasilkan output.  
Untuk informasi selengkapnya, lihat [Menggunakan AWS Identity and Access Management Access Analyzer](https://docs.aws.amazon.com/IAM/latest/UserGuide/what-is-access-analyzer.html) di *Panduan Pengguna AWS IAM*.  
+  Untuk detail API, lihat [UntagResource](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/accessanalyzer/untag-resource.html)di *Referensi AWS CLI Perintah*. 

### `update-archive-rule`
<a name="accessanalyzer_UpdateArchiveRule_cli_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`update-archive-rule`.

**AWS CLI**  
**Untuk memperbarui kriteria dan nilai untuk aturan arsip yang ditentukan**  
`update-archive-rule`Contoh berikut memperbarui kriteria dan nilai untuk aturan arsip yang ditentukan di AWS akun Anda.  

```
aws accessanalyzer update-archive-rule \
    --analyzer-name {{UnusedAccess-ConsoleAnalyzer-organization}} \
    --rule-name {{MyArchiveRule}} \
    --filter '{{{"resource": {"contains": ["Cognito"]}, "resourceType": {"eq": ["AWS::IAM::Role"]}}}}'
```
Perintah ini tidak menghasilkan output.  
Untuk informasi selengkapnya, lihat [Aturan arsip](https://docs.aws.amazon.com/IAM/latest/UserGuide/access-analyzer-archive-rules.html) di *Panduan Pengguna AWS IAM*.  
+  Untuk detail API, lihat [UpdateArchiveRule](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/accessanalyzer/update-archive-rule.html)di *Referensi AWS CLI Perintah*. 

### `update-findings`
<a name="accessanalyzer_UpdateFindings_cli_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`update-findings`.

**AWS CLI**  
**Untuk memperbarui status temuan yang ditentukan**  
`update-findings`Contoh berikut memperbarui status untuk temuan yang ditentukan di AWS akun Anda.  

```
aws accessanalyzer update-findings \
    --analyzer-arn {{arn:aws:access-analyzer:us-west-2:111122223333:analyzer/UnusedAccess-ConsoleAnalyzer-organization}} \
    --ids {{4f319ac3-2e0c-4dc4-bf51-7013a086b6ae}} {{780d586a-2cce-4f72-aff6-359d450e7500}} \
    --status {{ARCHIVED}}
```
Perintah ini tidak menghasilkan output.  
Untuk informasi selengkapnya, lihat [Menggunakan AWS Identity and Access Management Access Analyzer](https://docs.aws.amazon.com/IAM/latest/UserGuide/what-is-access-analyzer.html) di *Panduan Pengguna AWS IAM*.  
+  Untuk detail API, lihat [UpdateFindings](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/accessanalyzer/update-findings.html)di *Referensi AWS CLI Perintah*. 

### `validate-policy`
<a name="accessanalyzer_ValidatePolicy_cli_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`validate-policy`.

**AWS CLI**  
**Untuk meminta validasi kebijakan dan mengembalikan daftar temuan**  
`validate-policy`Contoh berikut meminta validasi kebijakan dan mengembalikan daftar temuan. Kebijakan dalam contoh adalah kebijakan kepercayaan peran untuk peran Amazon Cognito yang digunakan untuk federasi identitas web. Temuan yang dihasilkan dari kebijakan kepercayaan berhubungan dengan nilai `Sid` elemen kosong dan prinsip kebijakan yang tidak cocok karena tindakan peran asumsi yang salah digunakan,. `sts:AssumeRole` Tindakan peran asumsi yang benar untuk digunakan dengan Cognito adalah. `sts:AssumeRoleWithWebIdentity`  

```
aws accessanalyzer validate-policy \
    --policy-document {{file://myfile.json}} \
    --policy-type {{RESOURCE_POLICY}}
```
Isi dari `myfile.json`:  

```
{
    "Version":"2012-10-17",		 	 	 
    "Statement": [
        {
            "Sid": "",
            "Effect": "Allow",
            "Principal": {
                "Federated": "cognito-identity.amazonaws.com"
            },
            "Action": [
                "sts:AssumeRole",
                "sts:TagSession"
            ],
            "Condition": {
                "StringEquals": {
                    "cognito-identity.amazonaws.com:aud": "us-west-2_EXAMPLE"
                }
            }
        }
    ]
}
```
Output:  

```
{
    "findings": [
        {
            "findingDetails": "Add a value to the empty string in the Sid element.",
            "findingType": "SUGGESTION",
            "issueCode": "EMPTY_SID_VALUE",
            "learnMoreLink": "https://docs.aws.amazon.com/IAM/latest/UserGuide/access-analyzer-reference-policy-checks.html#access-analyzer-reference-policy-checks-suggestion-empty-sid-value",
            "locations": [
                {
                    "path": [
                        {
                            "value": "Statement"
                        },
                        {
                            "index": 0
                        },
                        {
                            "value": "Sid"
                        }
                    ],
                    "span": {
                        "end": {
                            "column": 21,
                            "line": 5,
                            "offset": 81
                        },
                        "start": {
                            "column": 19,
                            "line": 5,
                            "offset": 79
                        }
                    }
                }
            ]
        },
        {
            "findingDetails": "The sts:AssumeRole action is invalid with the following principal(s): cognito-identity.amazonaws.com. Use a SAML provider principal with the sts:AssumeRoleWithSAML action or use an OIDC provider principal with the sts:AssumeRoleWithWebIdentity action. Ensure the provider is Federated if you use either of the two options.",
            "findingType": "ERROR",
            "issueCode": "MISMATCHED_ACTION_FOR_PRINCIPAL",
            "learnMoreLink": "https://docs.aws.amazon.com/IAM/latest/UserGuide/access-analyzer-reference-policy-checks.html#access-analyzer-reference-policy-checks-error-mismatched-action-for-principal",
            "locations": [
                {
                    "path": [
                        {
                            "value": "Statement"
                        },
                        {
                            "index": 0
                        },
                        {
                            "value": "Action"
                        },
                        {
                            "index": 0
                        }
                    ],
                    "span": {
                        "end": {
                            "column": 32,
                            "line": 11,
                            "offset": 274
                        },
                        "start": {
                            "column": 16,
                            "line": 11,
                            "offset": 258
                        }
                    }
                },
                {
                    "path": [
                        {
                            "value": "Statement"
                        },
                        {
                            "index": 0
                        },
                        {
                            "value": "Principal"
                        },
                        {
                            "value": "Federated"
                        }
                    ],
                    "span": {
                        "end": {
                            "column": 61,
                            "line": 8,
                            "offset": 202
                        },
                        "start": {
                            "column": 29,
                            "line": 8,
                            "offset": 170
                        }
                    }
                }
            ]
        },
        {
            "findingDetails": "The following actions: sts:TagSession are not supported by the condition key cognito-identity.amazonaws.com:aud. The condition will not be evaluated for these actions. We recommend that you move these actions to a different statement without this condition key.",
            "findingType": "ERROR",
            "issueCode": "UNSUPPORTED_ACTION_FOR_CONDITION_KEY",
            "learnMoreLink": "https://docs.aws.amazon.com/IAM/latest/UserGuide/access-analyzer-reference-policy-checks.html#access-analyzer-reference-policy-checks-error-unsupported-action-for-condition-key",
            "locations": [
                {
                    "path": [
                        {
                            "value": "Statement"
                        },
                        {
                            "index": 0
                        },
                        {
                            "value": "Action"
                        },
                        {
                            "index": 1
                        }
                    ],
                    "span": {
                        "end": {
                            "column": 32,
                            "line": 12,
                            "offset": 308
                        },
                        "start": {
                            "column": 16,
                            "line": 12,
                            "offset": 292
                        }
                    }
                },
                {
                    "path": [
                        {
                            "value": "Statement"
                        },
                        {
                            "index": 0
                        },
                        {
                            "value": "Condition"
                        },
                        {
                            "value": "StringEquals"
                        },
                        {
                            "value": "cognito-identity.amazonaws.com:aud"
                        }
                    ],
                    "span": {
                        "end": {
                            "column": 79,
                            "line": 16,
                            "offset": 464
                        },
                        "start": {
                            "column": 58,
                            "line": 16,
                            "offset": 443
                        }
                    }
                }
            ]
        }
    ]
}
```
Untuk informasi selengkapnya, lihat [Memeriksa untuk memvalidasi kebijakan](https://docs.aws.amazon.com/IAM/latest/UserGuide/access-analyzer-checks-validating-policies.html) di *Panduan Pengguna AWS IAM*.  
+  Untuk detail API, lihat [ValidatePolicy](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/accessanalyzer/validate-policy.html)di *Referensi AWS CLI Perintah*. 