Created
January 24, 2023 14:19
-
-
Save beabetterdevv/3437fe6e932b409d8b267a70f2905f6b to your computer and use it in GitHub Desktop.
This file contains hidden or 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
Config | |
--- | |
{ | |
"customerIds": ["1", "2", "3"] | |
} | |
Validator | |
--- | |
{ | |
"$schema": "http://json-schema.org/draft-04/schema#", | |
"description": "My Config", | |
"type": "object", | |
"properties": { | |
"customerIds": { | |
"type": "array" | |
} | |
}, | |
"minProperties": 1, | |
"required": [ | |
"customerIds" | |
] | |
} | |
Policy | |
--- | |
{ | |
"Version": "2012-10-17", | |
"Statement": [ | |
{ | |
"Effect": "Allow", | |
"Action": [ | |
"cloudwatch:DescribeAlarms" | |
], | |
"Resource": "*" | |
} | |
] | |
} | |
Trust Relationship | |
--- | |
{ | |
"Version": "2012-10-17", | |
"Statement": [ | |
{ | |
"Effect": "Allow", | |
"Principal": { | |
"Service": "appconfig.amazonaws.com" | |
}, | |
"Action": "sts:AssumeRole" | |
} | |
] | |
} | |
Set Error State | |
--- | |
aws cloudwatch set-alarm-state --alarm-name "LambdaErrorAlarm" --state-value ALARM --state-reason "testing purposes" | |
Lambda Code | |
--- | |
import urllib.request | |
def lambda_handler(event, context): | |
url = f'http://localhost:2772/applications/application_name/environments/environment_name/configurations/configuration_name' | |
config = urllib.request.urlopen(url).read() | |
return config | |
Extensions / Layers Documentation | |
--- | |
https://docs.aws.amazon.com/appconfig/latest/userguide/appconfig-integration-lambda-extensions.html |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment