-
Notifications
You must be signed in to change notification settings - Fork 172
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #316 from awslabs/master
RELEASE 0.8.1
- Loading branch information
Showing
13 changed files
with
976 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file added
BIN
+119 KB
integration/config-opscenter-integration-example/AWS_Config_and_OpsCenter.pdf
Binary file not shown.
1 change: 1 addition & 0 deletions
1
integration/config-opscenter-integration-example/AWS_Config_and_OpsCenter.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<mxfile host="drawio.corp.amazon.com" modified="2021-07-07T20:39:15.069Z" agent="Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.114 Safari/537.36" etag="W84RUIU1xn6_EfwDyDGi" version="12.4.8" type="device"><diagram id="0hZAyJKCxBIlR_5_V_cb" name="Page-1">7Vptc6I8FP01flwnhBfxo1q32+nL9qnddfeTEyEiUyBMCL7sr38SCAqEbq2LrdNpnbHkJsTknMO9N1c7+ijcXFIUL2+Ji4MOBO6mo190IOxrPf4uDNvcYBYGj/pubtL2hon/B0sjkNbUd3FSGcgICZgfV40OiSLssIoNUUrW1WELElQ/NUYeVgwTBwWqdeq7bJlbbRPs7d+w7y2LT9aA7AlRMVgakiVyybpk0scdfUQJYflVuBnhQGBX4JLf9/WZ3t3CKI7YITeA/4Lpj+uHX3Q2C4ez+6fNzU/ni5HPskJBKjcsF8u2BQKUpJGLxSSgow/XS5/hSYwc0bvmlHPbkoUBb2n8Ul2UXOcKU4Y3JZNc5CUmIWZ0y4fIXqMn17AtlCABXO/x10w7ty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bzBTpqlMCjlAKMMbgge0mhOyNOr8xm88dkvoYEuMGXzd9YsWhcbqZCssS017jH1+TYFe39/5I5NjfhGsoD14iPxXgG3B2GhkCJSGqCwvDboWmZNftbb5kpQLcaUFfZ5kD72IF1CsZ0yHqgmCLqlBia76WutFuLS9PftlHkrO0onP7889K8naXrd8J08xQkJVpVzlhWIrGBO+ZXHMiAsFApSonki/s3FDnfO7ahTmeI+jvFF75vCm0aVW3hsCm/2axPxU5qhGz0bWsC2+qalt+RceHP/w5l8+P7XR/r4fw==</diagram></mxfile> |
36 changes: 36 additions & 0 deletions
36
integration/config-opscenter-integration-example/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
### AWS Config and OpsCenter integration ### | ||
|
||
This is an example showing how we can create a CloudWatch event to monitoring | ||
a change of compliance status and create an OpsItem in OpsCenter. | ||
|
||
# Scenario | ||
|
||
User wants to leverage OpsCenter to have a central location where operations engineers and IT professionals | ||
can view, investigate, and resolve operational work items (OpsItems) related to AWS resources. User also wants | ||
to create OpsItem automatically on non-compliant resouces found by AWS Config. In addition, OpsCenter provides | ||
action action to trigger a runbook. Engineers/professionals can easily trigger the remediation process with this | ||
feature. | ||
|
||
|
||
# Example Walkthrough | ||
|
||
pre-requisite: | ||
aws account, | ||
awscli, | ||
IAM role permission to create config rules, cloudwatch event and opsitem with cloudformation | ||
|
||
1. execute "sh build.sh" | ||
- create an IAM role and a managed config rule that checks if server side encryption enabled for a S3 bucket | ||
|
||
2. [Optional] Create a non-encrypted S3 bucket if you do not have one | ||
|
||
3. Go to AWS Config > Rules > my-config-rule-S3BucketServerSideEncryptionEnabled in Console | ||
- click action button and select re-evaluate | ||
|
||
4. Once the evaluation is done, go to AWS Systems Manager > OpsCenter in the console and user will see OpsItems created | ||
- User can get the details for the non-compliant resources, suggested runbook for remediation | ||
- User can execute the runbook to resolve the issue. | ||
- Please check the doc for more information on OpsCenter | ||
https://docs.aws.amazon.com/systems-manager/latest/userguide/OpsCenter.html | ||
|
||
5. execute "sh cleanup.sh" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#!/usr/bin/env bash | ||
|
||
|
||
aws cloudformation deploy --stack-name my-opsitem-role \ | ||
--template-file opsitem-role.yaml \ | ||
--capabilities CAPABILITY_IAM | ||
|
||
aws cloudformation deploy --stack-name my-config-rule \ | ||
--template-file s3EncryptedConfigRule.yaml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/usr/bin/env bash | ||
|
||
|
||
aws cloudformation delete-stack --stack-name my-opsitem-role | ||
aws cloudformation delete-stack --stack-name my-config-rule |
43 changes: 43 additions & 0 deletions
43
integration/config-opscenter-integration-example/opsitem-role.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# Copyright 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
# Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with | ||
# the License. A copy of the License is located at | ||
# http://aws.amazon.com/apache2.0/ | ||
# or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR | ||
# CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
AWSTemplateFormatVersion: '2010-09-09' | ||
Description: Role to create OpsItem with CloudWatch event | ||
|
||
Resources: | ||
|
||
OpsItemEventRole: | ||
Type: AWS::IAM::Role | ||
Properties: | ||
AssumeRolePolicyDocument: | ||
Version: 2012-10-17 | ||
Statement: | ||
- Effect: Allow | ||
Principal: | ||
Service: | ||
- events.amazonaws.com | ||
Action: | ||
- sts:AssumeRole | ||
Path: / | ||
Policies: | ||
- PolicyName: create-opsitem-event | ||
PolicyDocument: | ||
Version: "2012-10-17" | ||
Statement: | ||
- Effect: Allow | ||
Action: | ||
- ssm:CreateOpsItem | ||
Resource: "*" | ||
|
||
|
||
Outputs: | ||
OpsItemEventRoleArn: | ||
Value: !GetAtt OpsItemEventRole.Arn | ||
Description: 'Role to create OpsItem with CloudWatch event' | ||
Export: | ||
Name: "OpsItemEventRoleArn" |
70 changes: 70 additions & 0 deletions
70
integration/config-opscenter-integration-example/s3EncryptedConfigRule.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
# Copyright 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
# Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with | ||
# the License. A copy of the License is located at | ||
# http://aws.amazon.com/apache2.0/ | ||
# or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR | ||
# CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
AWSTemplateFormatVersion: 2010-09-09 | ||
|
||
Parameters: | ||
CloudWatchEventIAMRole: | ||
Type: String | ||
Description: The IAM role that grants CloudWatchEvent access to create OpsItems | ||
Default: opscenter-role | ||
|
||
Resources: | ||
S3BucketServerSideEncryptionEnabled: | ||
Type: AWS::Config::ConfigRule | ||
Properties: | ||
Scope: | ||
ComplianceResourceTypes: | ||
- "AWS::S3::Bucket" | ||
Source: | ||
Owner: AWS | ||
SourceIdentifier: "S3_BUCKET_SERVER_SIDE_ENCRYPTION_ENABLED" | ||
|
||
OpsItemGenForS3BucketServerSideEncryptionEnabled: | ||
Type: 'AWS::Events::Rule' | ||
Properties: | ||
Description: "CloudWatch Rule which creates Ops Items for CloudTrail Compliance Events" | ||
EventPattern: | ||
source: | ||
- aws.config | ||
detail-type: | ||
- 'Config Rules Compliance Change' | ||
detail: | ||
configRuleName: | ||
- !Ref S3BucketServerSideEncryptionEnabled | ||
newEvaluationResult: | ||
complianceType: | ||
- NON_COMPLIANT | ||
State: "ENABLED" | ||
Targets: | ||
- Arn: !Sub arn:${AWS::Partition}:ssm:${AWS::Region}:${AWS::AccountId}:opsitem | ||
Id: SSM-OpsItem | ||
RoleArn: !ImportValue OpsItemEventRoleArn | ||
InputTransformer: | ||
InputTemplate: | ||
Fn::Sub: | ||
'{ "title": "CloudTrail CloudWatch Logs Compliance Failure", | ||
"description": "CloudWatch Event Rule was triggered for Config Compliance Rule Failure.", | ||
"source": "Config Compliance", | ||
"priority": "2", | ||
"severity": "1", | ||
"notifications": [{ "arn": "arn:${AWS::Partition}:sns:${AWS::Region}:${AWS::AccountId}:OpsCenterEventNotificationTopic"}], | ||
"operationalData": { | ||
"/aws/dedup": {"type": "SearchableString","value": "{\"dedupString\":\"SSMOpsItems-S3-Encrypted-enabled-failed\"}"}, | ||
"/aws/automations": { "value": "[ { \"automationType\": \"AWS:SSM:Automation\", \"automationId\": \"AWS-EnableS3BucketEncryption\" } ]" }, | ||
"/aws/resources": {"value": "[{\"arn\":\"arn:aws:s3:::<resourceId>\"}]","type": "SearchableString"}, | ||
"configRuleName": {"type": "SearchableString","value": <configRuleName>}, | ||
"resourceType": {"type": "SearchableString","value": <resourceType>}, | ||
"resourceId": {"type": "SearchableString","value": <resourceId>} | ||
} | ||
}' | ||
InputPathsMap: | ||
resourceType: "$.detail.resourceType" | ||
resourceId: "$.detail.resourceId" | ||
configRuleName: "$.detail.configRuleName" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.