Skip to content

Commit f977384

Browse files
authored
Merge pull request #8777 from elysahall/awsdocs-07-01-24
CLI examples inspector2, lightsail, route53profiles
2 parents 6c162b4 + e55009b commit f977384

34 files changed

+818
-58
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
**To create a filter**
2+
3+
The following ``create-filter`` example creates a suppression rule that omits ECR instance type findings. ::
4+
5+
aws inspector2 create-filter \
6+
--name "ExampleSuppressionRuleECR" \
7+
--description "This suppression rule omits ECR instance type findings" \
8+
--action SUPPRESS \
9+
--filter-criteria 'resourceType=[{comparison="EQUALS", value="AWS_ECR_INSTANCE"}]'
10+
11+
Output::
12+
13+
{
14+
"arn": "arn:aws:inspector2:us-west-2:123456789012:owner/o-EXAMPLE222/filter/EXAMPLE444444444"
15+
}
16+
17+
For more information, see `Filtering Amazon Inspector findings <https://docs.aws.amazon.com/inspector/latest/user/findings-managing-filtering.html>`__ in the *Amazon Inspector User Guide*.
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
**To create a findings report**
2+
3+
The following ``create-findings-report`` example creates a finding report. ::
4+
5+
aws inspector2 create-findings-report \
6+
--report-format CSV \
7+
--s3-destination bucketName=inspector-sbom-123456789012,keyPrefix=sbom-key,kmsKeyArn=arn:aws:kms:us-west-2:123456789012:key/a1b2c3d4-5678-90ab-cdef-EXAMPLE33333 \
8+
--filter-criteria '{"ecrImageRepositoryName":[{"comparison":"EQUALS","value":"debian"}]}'
9+
10+
Output::
11+
12+
{
13+
"reportId": "a1b2c3d4-5678-90ab-cdef-EXAMPLE33333"
14+
}
15+
16+
For more information, see `Managing findings in Amazon Inspector <https://docs.aws.amazon.com/inspector/latest/user/findings-managing.html>`__ in the *Amazon Inspector User Guide*.
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
**To create a software bill of materials (SBOM) report**
2+
3+
The following ``create-sbom-export`` example creates a software bill of materials (SBOM) report. ::
4+
5+
aws inspector2 create-sbom-export \
6+
--report-format SPDX_2_3 \
7+
--resource-filter-criteria 'ecrRepositoryName=[{comparison="EQUALS",value="debian"}]' \
8+
--s3-destination bucketName=inspector-sbom-123456789012,keyPrefix=sbom-key,kmsKeyArn=arn:aws:kms:us-west-2:123456789012:key/a1b2c3d4-5678-90ab-cdef-EXAMPLE33333
9+
10+
Output::
11+
12+
{
13+
"reportId": "a1b2c3d4-5678-90ab-cdef-EXAMPLE33333"
14+
}
15+
16+
For more information, see `Exporting SBOMs with Amazon Inspector <https://docs.aws.amazon.com/inspector/latest/user/sbom-export.html>`__ in the *Amazon Inspector User Guide*.
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
**To delete a filter**
2+
3+
The following ``delete-filter`` example deletes a filter. ::
4+
5+
aws inspector2 delete-filter \
6+
--arn "arn:aws:inspector2:us-west-2:123456789012:owner/o-EXAMPLE222/filter/EXAMPLE444444444"
7+
8+
Output::
9+
10+
{
11+
"arn": "arn:aws:inspector2:us-west-2:123456789012:owner/o-EXAMPLE222/filter/EXAMPLE444444444"
12+
}
13+
14+
For more information, see `Filtering Amazon Inspector findings <https://docs.aws.amazon.com/inspector/latest/user/findings-managing-filtering.html>`__ in the *Amazon Inspector User Guide*.
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
**To get the setting configuration for Inspector scans**
2+
3+
The following ``get-configuration`` example gets the setting configuration for Inspector scans. ::
4+
5+
aws inspector2 get-configuration
6+
7+
Output::
8+
9+
{
10+
"ec2Configuration": {
11+
"scanModeState": {
12+
"scanMode": "EC2_HYBRID",
13+
"scanModeStatus": "SUCCESS"
14+
}
15+
},
16+
"ecrConfiguration": {
17+
"rescanDurationState": {
18+
"pullDateRescanDuration": "DAYS_90",
19+
"rescanDuration": "DAYS_30",
20+
"status": "SUCCESS",
21+
"updatedAt": "2024-05-14T21:16:20.237000+00:00"
22+
}
23+
}
24+
}
25+
26+
For more information, see `Automated resource scanning with Amazon Inspector <https://docs.aws.amazon.com/inspector/latest/user/scanning-resources.html>`__ in the *Amazon Inspector User Guide*.
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
**To list account permissions**
2+
3+
The following ``list-account-permissions`` example lists your account permissions. ::
4+
5+
aws inspector2 list-account-permissions
6+
7+
Output::
8+
9+
{
10+
"permissions": [
11+
{
12+
"operation": "ENABLE_SCANNING",
13+
"service": "ECR"
14+
},
15+
{
16+
"operation": "DISABLE_SCANNING",
17+
"service": "ECR"
18+
},
19+
{
20+
"operation": "ENABLE_REPOSITORY",
21+
"service": "ECR"
22+
},
23+
{
24+
"operation": "DISABLE_REPOSITORY",
25+
"service": "ECR"
26+
},
27+
{
28+
"operation": "ENABLE_SCANNING",
29+
"service": "EC2"
30+
},
31+
{
32+
"operation": "DISABLE_SCANNING",
33+
"service": "EC2"
34+
},
35+
{
36+
"operation": "ENABLE_SCANNING",
37+
"service": "LAMBDA"
38+
},
39+
{
40+
"operation": "DISABLE_SCANNING",
41+
"service": "LAMBDA"
42+
}
43+
]
44+
}
45+
46+
For more information, see `Identity and Access Management for Amazon Inspector <https://docs.aws.amazon.com/inspector/latest/user/security-iam.html>`__ in the *Amazon Inspector User Guide*.
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
**Example 1: To list coverage statistics by groups**
2+
3+
The following ``list-coverage-statistics`` example lists the coverage statistics of your AWS environment by groups. ::
4+
5+
aws inspector2 list-coverage-statistics \
6+
--group-by RESOURCE_TYPE
7+
8+
Output::
9+
10+
{
11+
"countsByGroup": [
12+
{
13+
"count": 56,
14+
"groupKey": "AWS_LAMBDA_FUNCTION"
15+
},
16+
{
17+
"count": 27,
18+
"groupKey": "AWS_ECR_REPOSITORY"
19+
},
20+
{
21+
"count": 18,
22+
"groupKey": "AWS_EC2_INSTANCE"
23+
},
24+
{
25+
"count": 3,
26+
"groupKey": "AWS_ECR_CONTAINER_IMAGE"
27+
},
28+
{
29+
"count": 1,
30+
"groupKey": "AWS_ACCOUNT"
31+
}
32+
],
33+
"totalCounts": 105
34+
}
35+
36+
For more information, see `Assessing Amazon Inspector coverage of your AWS environment <https://docs.aws.amazon.com/inspector/latest/user/assessing-coverage.html>`__ in the *Amazon Inspector User Guide*.
37+
38+
**Example 2: To list coverage statistics by resource type**
39+
40+
The following ``list-coverage-statistics`` example lists the coverage statistics of your AWS environment by resource type. ::
41+
42+
aws inspector2 list-coverage-statistics
43+
--filter-criteria '{"resourceType":[{"comparison":"EQUALS","value":"AWS_ECR_REPOSITORY"}]}'
44+
--group-by SCAN_STATUS_REASON
45+
46+
Output::
47+
48+
{
49+
"countsByGroup": [
50+
{
51+
"count": 27,
52+
"groupKey": "SUCCESSFUL"
53+
}
54+
],
55+
"totalCounts": 27
56+
}
57+
58+
For more information, see `Assessing Amazon Inspector coverage of your AWS environment <https://docs.aws.amazon.com/inspector/latest/user/assessing-coverage.html>`__ in the *Amazon Inspector User Guide*.
59+
60+
**Example 3: To list coverage statistics by ECR repository name**
61+
62+
The following ``list-coverage-statistics`` example lists the coverage statistics of your AWS environment by ECR repository name. ::
63+
64+
aws inspector2 list-coverage-statistics
65+
--filter-criteria '{"ecrRepositoryName":[{"comparison":"EQUALS","value":"debian"}]}'
66+
--group-by SCAN_STATUS_REASON
67+
68+
Output::
69+
70+
{
71+
"countsByGroup": [
72+
{
73+
"count": 3,
74+
"groupKey": "SUCCESSFUL"
75+
}
76+
],
77+
"totalCounts": 3
78+
}
79+
80+
For more information, see `Assessing Amazon Inspector coverage of your AWS environment <https://docs.aws.amazon.com/inspector/latest/user/assessing-coverage.html>`__ in the *Amazon Inspector User Guide*.
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
**Example 1: To list coverage details about your environment**
2+
3+
The following ``list-coverage`` example lists your environment's coverage details. ::
4+
5+
aws inspector2 list-coverage
6+
7+
Output::
8+
9+
{
10+
"coveredResources": [
11+
{
12+
"accountId": "123456789012",
13+
"lastScannedAt": "2024-05-20T16:23:20-07:00",
14+
"resourceId": "i-EXAMPLE55555555555",
15+
"resourceMetadata": {
16+
"ec2": {
17+
"amiId": "ami-EXAMPLE6666666666",
18+
"platform": "LINUX"
19+
}
20+
},
21+
"resourceType": "AWS_EC2_INSTANCE",
22+
"scanStatus": {
23+
"reason": "SUCCESSFUL",
24+
"statusCode": "ACTIVE"
25+
},
26+
"scanType": "PACKAGE"
27+
}
28+
]
29+
}
30+
31+
**Example 2: To list coverage details about the Lambda function resource type**
32+
33+
The following ``list-coverage`` example lists your Lamda function resource type details. ::
34+
35+
aws inspector2 list-coverage
36+
--filter-criteria '{"resourceType":[{"comparison":"EQUALS","value":"AWS_LAMBDA_FUNCTION"}]}'
37+
38+
Output::
39+
40+
{
41+
"coveredResources": [
42+
{
43+
"accountId": "123456789012",
44+
"resourceId": "arn:aws:lambda:us-west-2:123456789012:function:Eval-container-scan-results:$LATEST",
45+
"resourceMetadata": {
46+
"lambdaFunction": {
47+
"functionName": "Eval-container-scan-results",
48+
"functionTags": {},
49+
"layers": [],
50+
"runtime": "PYTHON_3_7"
51+
}
52+
},
53+
"resourceType": "AWS_LAMBDA_FUNCTION",
54+
"scanStatus": {
55+
"reason": "SUCCESSFUL",
56+
"statusCode": "ACTIVE"
57+
},
58+
"scanType": "CODE"
59+
}
60+
]
61+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
**To list information about the delegated administrator account of your organization**
2+
3+
The following ``list-delegated-admin-accounts`` example lists information about the delegated administrator account of your organization. ::
4+
5+
aws inspector2 list-delegated-admin-accounts
6+
7+
Output::
8+
9+
{
10+
"delegatedAdminAccounts": [
11+
{
12+
"accountId": "123456789012",
13+
"status": "ENABLED"
14+
}
15+
]
16+
}
17+
18+
For more information, see `Designating a delegated administrator for Amazon Inspector <https://docs.aws.amazon.com/inspector/latest/user/admin-member-relationship.html>`__ in the *Amazon Inspector User Guide*.
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
**To list filters associated with the account that you used to activated Amazon Inspector**
2+
3+
The following ``list-filters`` examples lists filters associated with the account that you used to activated Amazon Inspector. ::
4+
5+
aws inspector2 list-filters
6+
7+
Output::
8+
9+
{
10+
"filters": [
11+
{
12+
"action": "SUPPRESS",
13+
"arn": "arn:aws:inspector2:us-west-2:123456789012:owner/o-EXAMPLE222/filter/EXAMPLE444444444",
14+
"createdAt": "2024-05-15T21:11:08.602000+00:00",
15+
"criteria": {
16+
"resourceType": [
17+
{
18+
"comparison": "EQUALS",
19+
"value": "AWS_EC2_INSTANCE"
20+
},
21+
]
22+
},
23+
"description": "This suppression rule omits EC2 instance type findings",
24+
"name": "ExampleSuppressionRuleEC2",
25+
"ownerId": "o-EXAMPLE222",
26+
"tags": {},
27+
"updatedAt": "2024-05-15T21:11:08.602000+00:00"
28+
},
29+
{
30+
"action": "SUPPRESS",
31+
"arn": "arn:aws:inspector2:us-east-1:813737243517:owner/o-EXAMPLE222/filter/EXAMPLE444444444",
32+
"createdAt": "2024-05-15T21:28:27.054000+00:00",
33+
"criteria": {
34+
"resourceType": [
35+
{
36+
"comparison": "EQUALS",
37+
"value": "AWS_ECR_INSTANCE"
38+
}
39+
]
40+
},
41+
"description": "This suppression rule omits ECR instance type findings",
42+
"name": "ExampleSuppressionRuleECR",
43+
"ownerId": "o-EXAMPLE222",
44+
"tags": {},
45+
"updatedAt": "2024-05-15T21:28:27.054000+00:00"
46+
}
47+
]
48+
}
49+
50+
For more information, see `Filtering Amazon Inspector findings <https://docs.aws.amazon.com/inspector/latest/user/findings-managing-filtering.html>`__ in the *Amazon Inspector User Guide*.

0 commit comments

Comments
 (0)