Versi 5 (V5) Alat AWS untuk PowerShell telah dirilis!
Untuk informasi tentang mengubah perubahan dan memigrasikan aplikasi Anda, lihat topik https://docs.aws.amazon.com/powershell/v5/userguide/migrating-v5.html migrasi.
Terjemahan disediakan oleh mesin penerjemah. Jika konten terjemahan yang diberikan bertentangan dengan versi bahasa Inggris aslinya, utamakan versi bahasa Inggris.
AWS Config contoh menggunakan Tools for PowerShell V5
Contoh kode berikut menunjukkan cara melakukan tindakan dan menerapkan skenario umum dengan menggunakan Alat AWS untuk PowerShell V5 dengan AWS Config.
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 menggunakanAdd-CFGResourceTag.
- Alat untuk PowerShell V5
-
Contoh 1: Contoh ini mengaitkan tag tertentu ke sumber daya ARN, yaitu config- rule/config -rule-16iyn0 dalam kasus ini.
Add-CFGResourceTag -ResourceArn arn:aws:config:eu-west-1:123456789012:config-rule/config-rule-16iyn0 -Tag @{Key="Release";Value="Beta"}-
Untuk detail API, lihat TagResource di Referensi Alat AWS untuk PowerShell Cmdlet (V5).
-
Contoh kode berikut menunjukkan cara menggunakanGet-CFGAggregateComplianceByConfigRuleList.
- Alat untuk PowerShell V5
-
Contoh 1: Contoh ini mengambil detail dari pemfilter ConfigurationAggregator an 'kaju' untuk aturan konfigurasi yang diberikan dan ' expands/returns Kepatuhan' aturan.
Get-CFGAggregateComplianceByConfigRuleList -ConfigurationAggregatorName kaju -Filters_ConfigRuleName ALB_HTTP_TO_HTTPS_REDIRECTION_CHECK | Select-Object -ExpandProperty ComplianceOutput:
ComplianceContributorCount ComplianceType -------------------------- -------------- Amazon.ConfigService.Model.ComplianceContributorCount NON_COMPLIANTContoh 2: Contoh ini mengambil detail dari yang diberikan ConfigurationAggregator, menyaringnya untuk akun yang diberikan untuk semua wilayah yang tercakup dalam agregator dan selanjutnya mengembalikan kepatuhan untuk semua aturan.
Get-CFGAggregateComplianceByConfigRuleList -ConfigurationAggregatorName kaju -Filters_AccountId 123456789012 | Select-Object ConfigRuleName, @{N="Compliance";E={$_.Compliance.ComplianceType}}Output:
ConfigRuleName Compliance -------------- ---------- ALB_HTTP_TO_HTTPS_REDIRECTION_CHECK NON_COMPLIANT ec2-instance-no-public-ip NON_COMPLIANT desired-instance-type NON_COMPLIANT-
Untuk detail API, lihat DescribeAggregateComplianceByConfigRules di Referensi Alat AWS untuk PowerShell Cmdlet (V5).
-
Contoh kode berikut menunjukkan cara menggunakanGet-CFGAggregateComplianceDetailsByConfigRule.
- Alat untuk PowerShell V5
-
Contoh 1: Contoh ini mengembalikan hasil evaluasi memilih output dengan resource id dan tipe sumber daya untuk aturan AWS konfigurasi 'desired-instance-type' yang berada dalam status 'COMPLIANT' untuk akun, agregator, wilayah, dan aturan konfigurasi yang diberikan
Get-CFGAggregateComplianceDetailsByConfigRule -AccountId 123456789012 -AwsRegion eu-west-1 -ComplianceType COMPLIANT -ConfigRuleName desired-instance-type -ConfigurationAggregatorName raju | Select-Object -ExpandProperty EvaluationResultIdentifier | Select-Object -ExpandProperty EvaluationResultQualifierOutput:
ConfigRuleName ResourceId ResourceType -------------- ---------- ------------ desired-instance-type i-0f1bf2f34c5678d12 AWS::EC2::Instance desired-instance-type i-0fd12dd3456789123 AWS::EC2::Instance-
Untuk detail API, lihat GetAggregateComplianceDetailsByConfigRule di Referensi Alat AWS untuk PowerShell Cmdlet (V5).
-
Contoh kode berikut menunjukkan cara menggunakanGet-CFGAggregateConfigRuleComplianceSummary.
- Alat untuk PowerShell V5
-
Contoh 1: Contoh ini mengembalikan jumlah aturan yang tidak sesuai untuk agregator yang diberikan.
(Get-CFGAggregateConfigRuleComplianceSummary -ConfigurationAggregatorName raju).AggregateComplianceCounts.ComplianceSummary.NonCompliantResourceCountOutput:
CapExceeded CappedCount ----------- ----------- False 5-
Untuk detail API, lihat GetAggregateConfigRuleComplianceSummary di Referensi Alat AWS untuk PowerShell Cmdlet (V5).
-
Contoh kode berikut menunjukkan cara menggunakanGet-CFGAggregateDiscoveredResourceCount.
- Alat untuk PowerShell V5
-
Contoh 1: Contoh ini mengembalikan jumlah sumber daya untuk agregator yang diberikan yang difilter untuk wilayah us-east-1.
Get-CFGAggregateDiscoveredResourceCount -ConfigurationAggregatorName Master -Filters_Region us-east-1Output:
GroupByKey GroupedResourceCounts NextToken TotalDiscoveredResources ---------- --------------------- --------- ------------------------ {} 455Contoh 2: Contoh ini mengembalikan jumlah sumber daya yang dikelompokkan berdasarkan RESOURCE_TYPE untuk wilayah yang difilter untuk agregator yang diberikan.
Get-CFGAggregateDiscoveredResourceCount -ConfigurationAggregatorName Master -Filters_Region us-east-1 -GroupByKey RESOURCE_TYPE | Select-Object -ExpandProperty GroupedResourceCountsOutput:
GroupName ResourceCount --------- ------------- AWS::CloudFormation::Stack 12 AWS::CloudFront::Distribution 1 AWS::CloudTrail::Trail 1 AWS::DynamoDB::Table 1 AWS::EC2::EIP 2 AWS::EC2::FlowLog 2 AWS::EC2::InternetGateway 4 AWS::EC2::NatGateway 2 AWS::EC2::NetworkAcl 4 AWS::EC2::NetworkInterface 12 AWS::EC2::RouteTable 13 AWS::EC2::SecurityGroup 18 AWS::EC2::Subnet 16 AWS::EC2::VPC 4 AWS::EC2::VPCEndpoint 2 AWS::EC2::VPCPeeringConnection 1 AWS::IAM::Group 2 AWS::IAM::Policy 51 AWS::IAM::Role 78 AWS::IAM::User 7 AWS::Lambda::Function 3 AWS::RDS::DBSecurityGroup 1 AWS::S3::Bucket 3 AWS::SSM::AssociationCompliance 107 AWS::SSM::ManagedInstanceInventory 108-
Untuk detail API, lihat GetAggregateDiscoveredResourceCounts di Referensi Alat AWS untuk PowerShell Cmdlet (V5).
-
Contoh kode berikut menunjukkan cara menggunakanGet-CFGAggregateDiscoveredResourceList.
- Alat untuk PowerShell V5
-
Contoh 1: Contoh ini mengembalikan pengidentifikasi sumber daya untuk jenis sumber daya tertentu yang dikumpulkan dalam agregator 'Irlandia'. Untuk daftar jenis sumber daya, silakan periksahttps://docs.aws.amazon.com/sdkfornet/v4/apidocs/index.html? halaman= ConfigService/TConfigServiceResourceType.html & Amazon_ConfigService_ResourceType tocid=.
Get-CFGAggregateDiscoveredResourceList -ConfigurationAggregatorName Ireland -ResourceType ([Amazon.ConfigService.ResourceType]::AWSAutoScalingAutoScalingGroup)Output:
ResourceId : arn:aws:autoscaling:eu-west-1:123456789012:autoScalingGroup:12e3b4fc-1234-1234-a123-1d2ba3c45678:autoScalingGroupName/asg-1 ResourceName : asg-1 ResourceType : AWS::AutoScaling::AutoScalingGroup SourceAccountId : 123456789012 SourceRegion : eu-west-1Contoh 2: Contoh ini mengembalikan tipe sumber daya
AwsEC2SecurityGroupbernama 'default' untuk agregator yang diberikan yang difilter dengan wilayah us-east-1.Get-CFGAggregateDiscoveredResourceList -ConfigurationAggregatorName raju -ResourceType ([Amazon.ConfigService.ResourceType]::AWSEC2SecurityGroup) -Filters_Region us-east-1 -Filters_ResourceName defaultOutput:
ResourceId : sg-01234bd5dbfa67c89 ResourceName : default ResourceType : AWS::EC2::SecurityGroup SourceAccountId : 123456789102 SourceRegion : us-east-1 ResourceId : sg-0123a4ebbf56789be ResourceName : default ResourceType : AWS::EC2::SecurityGroup SourceAccountId : 123456789102 SourceRegion : us-east-1 ResourceId : sg-4fc1d234 ResourceName : default ResourceType : AWS::EC2::SecurityGroup SourceAccountId : 123456789102 SourceRegion : us-east-1-
Untuk detail API, lihat ListAggregateDiscoveredResources di Referensi Alat AWS untuk PowerShell Cmdlet (V5).
-
Contoh kode berikut menunjukkan cara menggunakanGet-CFGAggregateResourceConfig.
- Alat untuk PowerShell V5
-
Contoh 1: Contoh ini mengembalikan Item Konfigurasi untuk sumber daya yang diberikan dikumpulkan dan memperluas Konfigurasi.
(Get-CFGAggregateResourceConfig -ResourceIdentifier_SourceRegion us-east-1 -ResourceIdentifier_SourceAccountId 123456789012 -ResourceIdentifier_ResourceId sg-4fc1d234 -ResourceIdentifier_ResourceType ([Amazon.ConfigService.ResourceType]::AWSEC2SecurityGroup) -ConfigurationAggregatorName raju).Configuration | ConvertFrom-JsonOutput:
{"description":"default VPC security group","groupName":"default","ipPermissions":[{"ipProtocol":"-1","ipv6Ranges":[],"prefixListIds":[],"userIdGroupPairs":[{"groupId":"sg-4fc1d234","userId":"123456789012"}],"ipv4Ranges":[],"ipRanges":[]},{"fromPort":3389,"ipProtocol":"tcp","ipv6Ranges":[],"prefixListIds":[],"toPort":3389,"userIdGroupPairs":[],"ipv4Ranges":[{"cidrIp":"54.240.197.224/29","description":"office subnet"},{"cidrIp":"72.21.198.65/32","description":"home pc"}],"ipRanges":["54.240.197.224/29","72.21.198.65/32"]}],"ownerId":"123456789012","groupId":"sg-4fc1d234","ipPermissionsEgress":[{"ipProtocol":"-1","ipv6Ranges":[],"prefixListIds":[],"userIdGroupPairs":[],"ipv4Ranges":[{"cidrIp":"0.0.0.0/0"}],"ipRanges":["0.0.0.0/0"]}],"tags":[],"vpcId":"vpc-2d1c2e34"}-
Untuk detail API, lihat GetAggregateResourceconfig-service di Referensi Alat AWS untuk PowerShell Cmdlet (V5).
-
Contoh kode berikut menunjukkan cara menggunakanGet-CFGAggregateResourceConfigBatch.
- Alat untuk PowerShell V5
-
Contoh 1: Contoh ini mengambil item konfigurasi saat ini untuk sumber daya (diidentifikasi) yang ada di agregator yang diberikan.
$resIdentifier=[Amazon.ConfigService.Model.AggregateResourceIdentifier]@{ ResourceId= "i-012e3cb4df567e8aa" ResourceName = "arn:aws:ec2:eu-west-1:123456789012:instance/i-012e3cb4df567e8aa" ResourceType = [Amazon.ConfigService.ResourceType]::AWSEC2Instance SourceAccountId = "123456789012" SourceRegion = "eu-west-1" } Get-CFGAggregateResourceConfigBatch -ResourceIdentifier $resIdentifier -ConfigurationAggregatorName rajuOutput:
BaseConfigurationItems UnprocessedResourceIdentifiers ---------------------- ------------------------------ {} {arn:aws:ec2:eu-west-1:123456789012:instance/i-012e3cb4df567e8aa}-
Untuk detail API, lihat BatchGetAggregateResourceconfig-service di Referensi Alat AWS untuk PowerShell Cmdlet (V5).
-
Contoh kode berikut menunjukkan cara menggunakanGet-CFGAggregationAuthorizationList.
- Alat untuk PowerShell V5
-
Contoh 1: Contoh ini mengambil otorisasi yang diberikan kepada agregator.
Get-CFGAggregationAuthorizationListOutput:
AggregationAuthorizationArn AuthorizedAccountId AuthorizedAwsRegion CreationTime --------------------------- ------------------- ------------------- ------------ arn:aws:config-service:eu-west-1:123456789012:aggregation-authorization/123456789012/eu-west-1 123456789012 eu-west-1 8/26/2019 12:55:27 AM-
Untuk detail API, lihat DescribeAggregationAuthorizations di Referensi Alat AWS untuk PowerShell Cmdlet (V5).
-
Contoh kode berikut menunjukkan cara menggunakanGet-CFGComplianceByConfigRule.
- Alat untuk PowerShell V5
-
Contoh 1: Contoh ini mengambil detail kepatuhan untuk aturan ebs-optimized-instance, yang tidak ada hasil evaluasi saat ini untuk aturan, sehingga mengembalikan INSUFFICIENT_DATA
(Get-CFGComplianceByConfigRule -ConfigRuleName ebs-optimized-instance).ComplianceOutput:
ComplianceContributorCount ComplianceType -------------------------- -------------- INSUFFICIENT_DATAContoh 2: Contoh ini mengembalikan jumlah sumber daya yang tidak sesuai untuk aturan ALB_HTTP_TO_HTTPS_REDIRECTION_CHECK.
(Get-CFGComplianceByConfigRule -ConfigRuleName ALB_HTTP_TO_HTTPS_REDIRECTION_CHECK -ComplianceType NON_COMPLIANT).Compliance.ComplianceContributorCountOutput:
CapExceeded CappedCount ----------- ----------- False 2-
Untuk detail API, lihat DescribeComplianceByConfigRule di Referensi Alat AWS untuk PowerShell Cmdlet (V5).
-
Contoh kode berikut menunjukkan cara menggunakanGet-CFGComplianceByResource.
- Alat untuk PowerShell V5
-
Contoh 1: Contoh ini memeriksa jenis
AWS::SSM::ManagedInstanceInventorysumber daya untuk tipe kepatuhan 'COMPLIANT'.Get-CFGComplianceByResource -ComplianceType COMPLIANT -ResourceType AWS::SSM::ManagedInstanceInventoryOutput:
Compliance ResourceId ResourceType ---------- ---------- ------------ Amazon.ConfigService.Model.Compliance i-0123bcf4b567890e3 AWS::SSM::ManagedInstanceInventory Amazon.ConfigService.Model.Compliance i-0a1234f6f5d6b78f7 AWS::SSM::ManagedInstanceInventory-
Untuk detail API, lihat DescribeComplianceByResource di Referensi Alat AWS untuk PowerShell Cmdlet (V5).
-
Contoh kode berikut menunjukkan cara menggunakanGet-CFGComplianceDetailsByConfigRule.
- Alat untuk PowerShell V5
-
Contoh 1: Contoh ini memperoleh hasil evaluasi untuk aturan access-keys-dan mengembalikan output yang dikelompokkan berdasarkan tipe kepatuhan
Get-CFGComplianceDetailsByConfigRule -ConfigRuleName access-keys-rotated | Group-Object ComplianceTypeOutput:
Count Name Group ----- ---- ----- 2 COMPLIANT {Amazon.ConfigService.Model.EvaluationResult, Amazon.ConfigService.Model.EvaluationResult} 5 NON_COMPLIANT {Amazon.ConfigService.Model.EvaluationResult, Amazon.ConfigService.Model.EvaluationResult, Amazon.ConfigService.Model.EvaluationRes...Contoh 2: Contoh ini menanyakan detail kepatuhan untuk aturan access-keys-untuk resource COMPLIANT.
Get-CFGComplianceDetailsByConfigRule -ConfigRuleName access-keys-rotated -ComplianceType COMPLIANT | ForEach-Object {$_.EvaluationResultIdentifier.EvaluationResultQualifier}Output:
ConfigRuleName ResourceId ResourceType -------------- ---------- ------------ access-keys-rotated BCAB1CDJ2LITAPVEW3JAH AWS::IAM::User access-keys-rotated BCAB1CDJ2LITL3EHREM4Q AWS::IAM::User-
Untuk detail API, lihat GetComplianceDetailsByConfigRule di Referensi Alat AWS untuk PowerShell Cmdlet (V5).
-
Contoh kode berikut menunjukkan cara menggunakanGet-CFGComplianceDetailsByResource.
- Alat untuk PowerShell V5
-
Contoh 1: Contoh hasil evaulasi ini untuk sumber daya yang diberikan.
Get-CFGComplianceDetailsByResource -ResourceId ABCD5STJ4EFGHIVEW6JAH -ResourceType 'AWS::IAM::User'Output:
Annotation : ComplianceType : COMPLIANT ConfigRuleInvokedTime : 8/25/2019 11:34:56 PM EvaluationResultIdentifier : Amazon.ConfigService.Model.EvaluationResultIdentifier ResultRecordedTime : 8/25/2019 11:34:56 PM ResultToken :-
Untuk detail API, lihat GetComplianceDetailsByResource di Referensi Alat AWS untuk PowerShell Cmdlet (V5).
-
Contoh kode berikut menunjukkan cara menggunakanGet-CFGComplianceSummaryByConfigRule.
- Alat untuk PowerShell V5
-
Contoh 1: Sampel ini mengembalikan jumlah aturan Config yang tidak sesuai.
Get-CFGComplianceSummaryByConfigRule -Select ComplianceSummary.NonCompliantResourceCountOutput:
CapExceeded CappedCount ----------- ----------- False 9-
Untuk detail API, lihat GetComplianceSummaryByConfigRule di Referensi Alat AWS untuk PowerShell Cmdlet (V5).
-
Contoh kode berikut menunjukkan cara menggunakanGet-CFGComplianceSummaryByResourceType.
- Alat untuk PowerShell V5
-
Contoh 1: Sampel ini mengembalikan jumlah sumber daya yang sesuai atau tidak sesuai dan mengonversi output ke json.
Get-CFGComplianceSummaryByResourceType -Select ComplianceSummariesByResourceType.ComplianceSummary | ConvertTo-Json { "ComplianceSummaryTimestamp": "2019-12-14T06:14:49.778Z", "CompliantResourceCount": { "CapExceeded": false, "CappedCount": 2 }, "NonCompliantResourceCount": { "CapExceeded": true, "CappedCount": 100 } }-
Untuk detail API, lihat GetComplianceSummaryByResourceType di Referensi Alat AWS untuk PowerShell Cmdlet (V5).
-
Contoh kode berikut menunjukkan cara menggunakanGet-CFGConfigRule.
- Alat untuk PowerShell V5
-
Contoh 1: Contoh ini mencantumkan aturan konfigurasi untuk akun, dengan properti yang dipilih.
Get-CFGConfigRule | Select-Object ConfigRuleName, ConfigRuleId, ConfigRuleArn, ConfigRuleStateOutput:
ConfigRuleName ConfigRuleId ConfigRuleArn ConfigRuleState -------------- ------------ ------------- --------------- ALB_REDIRECTION_CHECK config-rule-12iyn3 arn:aws:config-service:eu-west-1:123456789012:config-rule/config-rule-12iyn3 ACTIVE access-keys-rotated config-rule-aospfr arn:aws:config-service:eu-west-1:123456789012:config-rule/config-rule-aospfr ACTIVE autoscaling-group-elb-healthcheck-required config-rule-cn1f2x arn:aws:config-service:eu-west-1:123456789012:config-rule/config-rule-cn1f2x ACTIVE-
Untuk detail API, lihat DescribeConfigRules di Referensi Alat AWS untuk PowerShell Cmdlet (V5).
-
Contoh kode berikut menunjukkan cara menggunakanGet-CFGConfigRuleEvaluationStatus.
- Alat untuk PowerShell V5
-
Contoh 1: Sampel ini mengembalikan informasi status untuk aturan konfigurasi yang diberikan.
Get-CFGConfigRuleEvaluationStatus -ConfigRuleName root-account-mfa-enabled, vpc-flow-logs-enabledOutput:
ConfigRuleArn : arn:aws:config:eu-west-1:123456789012:config-rule/config-rule-kvq1wk ConfigRuleId : config-rule-kvq1wk ConfigRuleName : root-account-mfa-enabled FirstActivatedTime : 8/27/2019 8:05:17 AM FirstEvaluationStarted : True LastErrorCode : LastErrorMessage : LastFailedEvaluationTime : 1/1/0001 12:00:00 AM LastFailedInvocationTime : 1/1/0001 12:00:00 AM LastSuccessfulEvaluationTime : 12/13/2019 8:12:03 AM LastSuccessfulInvocationTime : 12/13/2019 8:12:03 AM ConfigRuleArn : arn:aws:config:eu-west-1:123456789012:config-rule/config-rule-z1s23b ConfigRuleId : config-rule-z1s23b ConfigRuleName : vpc-flow-logs-enabled FirstActivatedTime : 8/14/2019 6:23:44 AM FirstEvaluationStarted : True LastErrorCode : LastErrorMessage : LastFailedEvaluationTime : 1/1/0001 12:00:00 AM LastFailedInvocationTime : 1/1/0001 12:00:00 AM LastSuccessfulEvaluationTime : 12/13/2019 7:12:01 AM LastSuccessfulInvocationTime : 12/13/2019 7:12:01 AM-
Untuk detail API, lihat DescribeConfigRuleEvaluationStatus di Referensi Alat AWS untuk PowerShell Cmdlet (V5).
-
Contoh kode berikut menunjukkan cara menggunakanGet-CFGConfigurationAggregatorList.
- Alat untuk PowerShell V5
-
Contoh 1: Sampel ini mengembalikan semua agregator untuk. region/account
Get-CFGConfigurationAggregatorListOutput:
AccountAggregationSources : {Amazon.ConfigService.Model.AccountAggregationSource} ConfigurationAggregatorArn : arn:aws:config-service:eu-west-1:123456789012:config-aggregator/config-aggregator-xabca1me ConfigurationAggregatorName : IrelandMaster CreationTime : 8/25/2019 11:42:39 PM LastUpdatedTime : 8/25/2019 11:42:39 PM OrganizationAggregationSource : AccountAggregationSources : {} ConfigurationAggregatorArn : arn:aws:config-service:eu-west-1:123456789012:config-aggregator/config-aggregator-qubqabcd ConfigurationAggregatorName : raju CreationTime : 8/11/2019 8:39:25 AM LastUpdatedTime : 8/11/2019 8:39:25 AM OrganizationAggregationSource : Amazon.ConfigService.Model.OrganizationAggregationSource-
Untuk detail API, lihat DescribeConfigurationAggregators di Referensi Alat AWS untuk PowerShell Cmdlet (V5).
-
Contoh kode berikut menunjukkan cara menggunakanGet-CFGConfigurationAggregatorSourcesStatus.
- Alat untuk PowerShell V5
-
Contoh 1: Sampel ini menampilkan bidang yang diminta untuk sumber dalam agregator yang diberikan.
Get-CFGConfigurationAggregatorSourcesStatus -ConfigurationAggregatorName raju | select SourceType, LastUpdateStatus, LastUpdateTime, SourceIdOutput:
SourceType LastUpdateStatus LastUpdateTime SourceId ---------- ---------------- -------------- -------- ORGANIZATION SUCCEEDED 12/31/2019 7:45:06 AM Organization ACCOUNT SUCCEEDED 12/31/2019 7:09:38 AM 612641234567 ACCOUNT SUCCEEDED 12/31/2019 7:12:53 AM 933301234567 ACCOUNT SUCCEEDED 12/31/2019 7:18:10 AM 933301234567 ACCOUNT SUCCEEDED 12/31/2019 7:25:17 AM 933301234567 ACCOUNT SUCCEEDED 12/31/2019 7:25:49 AM 612641234567 ACCOUNT SUCCEEDED 12/31/2019 7:26:11 AM 612641234567-
Untuk detail API, lihat DescribeConfigurationAggregatorSourcesStatus di Referensi Alat AWS untuk PowerShell Cmdlet (V5).
-
Contoh kode berikut menunjukkan cara menggunakanGet-CFGConfigurationRecorder.
- Alat untuk PowerShell V5
-
Contoh 1: Contoh ini mengembalikan detail perekam konfigurasi.
Get-CFGConfigurationRecorder | Format-ListOutput:
Name : default RecordingGroup : Amazon.ConfigService.Model.RecordingGroup RoleARN : arn:aws:iam::123456789012:role/aws-service-role/config.amazonaws.com/AWSServiceRoleForConfig-
Untuk detail API, lihat DescribeConfigurationRecorders di Referensi Alat AWS untuk PowerShell Cmdlet (V5).
-
Contoh kode berikut menunjukkan cara menggunakanGet-CFGConfigurationRecorderStatus.
- Alat untuk PowerShell V5
-
Contoh 1: Sampel ini mengembalikan status perekam konfigurasi.
Get-CFGConfigurationRecorderStatusOutput:
LastErrorCode : LastErrorMessage : LastStartTime : 10/11/2019 10:13:51 AM LastStatus : Success LastStatusChangeTime : 12/31/2019 6:14:12 AM LastStopTime : 10/11/2019 10:13:46 AM Name : default Recording : True-
Untuk detail API, lihat DescribeConfigurationRecorderStatus di Referensi Alat AWS untuk PowerShell Cmdlet (V5).
-
Contoh kode berikut menunjukkan cara menggunakanGet-CFGConformancePack.
- Alat untuk PowerShell V5
-
Contoh 1: Contoh ini mencantumkan semua paket kesesuaian.
Get-CFGConformancePackOutput:
ConformancePackArn : arn:aws:config:eu-west-1:123456789012:conformance-pack/dono/conformance-pack-p0acq8bpz ConformancePackId : conformance-pack-p0acabcde ConformancePackInputParameters : {} ConformancePackName : dono CreatedBy : DeliveryS3Bucket : kt-ps-examples DeliveryS3KeyPrefix : LastUpdateRequestedTime : 12/31/2019 8:45:31 AM-
Untuk detail API, lihat DescribeConformancePacks di Referensi Alat AWS untuk PowerShell Cmdlet (V5).
-
Contoh kode berikut menunjukkan cara menggunakanGet-CFGDeliveryChannel.
- Alat untuk PowerShell V5
-
Contoh 1: Contoh ini mengambil saluran pengiriman untuk wilayah dan menampilkan detail.
Get-CFGDeliveryChannel -Region eu-west-1 | Select-Object Name, S3BucketName, S3KeyPrefix, @{N="DeliveryFrequency";E={$_.ConfigSnapshotDeliveryProperties.DeliveryFrequency}}Output:
Name S3BucketName S3KeyPrefix DeliveryFrequency ---- ------------ ----------- ----------------- default config-bucket-NA my TwentyFour_Hours-
Untuk detail API, lihat DescribeDeliveryChannels di Referensi Alat AWS untuk PowerShell Cmdlet (V5).
-
Contoh kode berikut menunjukkan cara menggunakanGet-CFGResourceTag.
- Alat untuk PowerShell V5
-
Contoh 1: Contoh ini mencantumkan tag terkait untuk sumber daya yang diberikan
Get-CFGResourceTag -ResourceArn $rules[0].ConfigRuleArnOutput:
Key Value --- ----- Version 1.3-
Untuk detail API, lihat ListTagsForResource di Referensi Alat AWS untuk PowerShell Cmdlet (V5).
-
Contoh kode berikut menunjukkan cara menggunakanRemove-CFGConformancePack.
- Alat untuk PowerShell V5
-
Contoh 1: Sampel ini menghapus paket kesesuaian yang diberikan, bersama dengan semua aturan, tindakan remediasi, dan hasil evaluasi untuk paket.
Remove-CFGConformancePack -ConformancePackName donoOutput:
Confirm Are you sure you want to perform this action? Performing the operation "Remove-CFGConformancePack (DeleteConformancePack)" on target "dono". [Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "Y"): Y-
Untuk detail API, lihat DeleteConformancePack di Referensi Alat AWS untuk PowerShell Cmdlet (V5).
-
Contoh kode berikut menunjukkan cara menggunakanWrite-CFGConformancePack.
- Alat untuk PowerShell V5
-
Contoh 1: Sampel ini membuat paket kesesuaian, mengambil template dari file yaml yang diberikan.
Write-CFGConformancePack -ConformancePackName dono -DeliveryS3Bucket amzn-s3-demo-bucket -TemplateBody (Get-Content C:\windows\temp\template.yaml -Raw)-
Untuk detail API, lihat PutConformancePack di Referensi Alat AWS untuk PowerShell Cmdlet (V5).
-
Contoh kode berikut menunjukkan cara menggunakanWrite-CFGDeliveryChannel.
- Alat untuk PowerShell V5
-
Contoh 1: Contoh ini mengubah properti deliveryFrequency dari saluran pengiriman yang ada.
Write-CFGDeliveryChannel -ConfigSnapshotDeliveryProperties_DeliveryFrequency TwentyFour_Hours -DeliveryChannelName default -DeliveryChannel_S3BucketName amzn-s3-demo-bucket -DeliveryChannel_S3KeyPrefix my-
Untuk detail API, lihat PutDeliveryChannel di Referensi Alat AWS untuk PowerShell Cmdlet (V5).
-