Skip to content

Instantly share code, notes, and snippets.

@CharlieDigital
Created February 17, 2021 03:06
Show Gist options
  • Save CharlieDigital/58d03aee8820d344757225e724f1cf02 to your computer and use it in GitHub Desktop.
Save CharlieDigital/58d03aee8820d344757225e724f1cf02 to your computer and use it in GitHub Desktop.
CloudFormation JSON template which demonstrates how to create an HTTP data source for AWS Secrets Manager
{
"AWSTemplateFormatVersion": "2010-09-09",
"Description": "Test stack",
"Metadata": {},
"Parameters": {
"AppSyncApiId": {
"Type": "String",
"Description": "The id of the AppSync API associated with this project."
}
},
"Resources": {
"AppSyncServiceRoleTest": {
"Type": "AWS::IAM::Role",
"Properties": {
"AssumeRolePolicyDocument": {
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"Service": "appsync.amazonaws.com"
},
"Action": "sts:AssumeRole"
}
]
},
"Policies": [
{
"PolicyName": "AppSyncSecretsManagerTestPolicy",
"PolicyDocument": {
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"secretsmanager:Get*"
],
"Resource": "*"
}
]
}
}
]
}
},
"SecretsManagerDataSourceTest": {
"Type": "AWS::AppSync::DataSource",
"Properties": {
"ApiId": {
"Ref": "AppSyncApiId"
},
"Name": "SecretsManager_Test",
"Type": "HTTP",
"ServiceRoleArn": {
"Fn::GetAtt": "AppSyncServiceRoleTest.Arn"
},
"HttpConfig": {
"Endpoint": {
"Fn::Sub": [
"https://secretsmanager.${region}.amazonaws.com",
{
"region": {
"Ref": "AWS::Region"
}
}
]
},
"AuthorizationConfig": {
"AuthorizationType": "AWS_IAM",
"AwsIamConfig": {
"SigningRegion": {
"Ref": "AWS::Region"
},
"SigningServiceName": "secretsmanager"
}
}
}
}
},
"AzureQnaDataSourceTest": {
"Type": "AWS::AppSync::DataSource",
"Properties": {
"ApiId": {
"Ref": "AppSyncApiId"
},
"Name": "AzureQna_Test",
"Type": "HTTP",
"HttpConfig": {
"Endpoint": "https://your-domain-here.cognitiveservices.azure.com"
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment