Last active
May 19, 2023 01:47
-
-
Save and2long/fdc80e24b130ab17b46a7b555325e301 to your computer and use it in GitHub Desktop.
将 DynamoDB json 数据转换成普通 json 数据。
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
from boto3.dynamodb.types import TypeDeserializer, TypeSerializer | |
def from_dynamodb_to_json(item): | |
d = TypeDeserializer() | |
return {k: d.deserialize(value=v) for k, v in item.items()} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
{
"Description": "Deploy an Elastic Beanstalk app stored in CodeCommit via CodePipeline.",
"AWSTemplateFormatVersion": "2010-09-09",
"Parameters": {
"RepositoryName": {
"Description": "enter the name of your GitHub source repository",
"Type": "String"
},
"BranchName": {
"Description": "enter the repository branch",
"Type": "String",
"Default": "master"
},
"GitHubOwner": {
"Description": "enter the GitHub owner of the repository",
"Type": "String"
},
"GitHubOAuthToken": {
"Description": "enter the personal access key for your GitHub repository",
"Type": "String",
"NoEcho": true
},
"VpcId": {
"Type": "AWS::EC2::VPC::Id"
},
"ElasticBeanstalkPlatform": {
"Description": "enter the latest Java SE version in https://docs.aws.amazon.com/elasticbeanstalk/latest/platforms/platforms-supported.html#platforms-supported.javase",
"Type": "String",
"Default": "64bit Amazon Linux 2018.03 v2.10.3 running Java 8"
}
},
"Resources": {
"CodePipelineArtifactStoreBucket": {
"Type": "AWS::S3::Bucket"
},
"OAuthAccessTokenTable": {
"Type": "AWS::DynamoDB::Table",
"Properties": {
"TableName": "OAuthAccessToken",
"AttributeDefinitions": [
{
"AttributeName": "tokenId",
"AttributeType": "S"
},
{
"AttributeName": "authenticationId",
"AttributeType": "S"
},
{
"AttributeName": "clientId",
"AttributeType": "S"
},
{
"AttributeName": "userName",
"AttributeType": "S"
},
{
"AttributeName": "refreshToken",
"AttributeType": "S"
}
],
"KeySchema": [
{
"AttributeName": "tokenId",
"KeyType": "HASH"
}
],
"BillingMode": "PAY_PER_REQUEST",
"GlobalSecondaryIndexes": [
{
"IndexName": "authenticationId-index",
"KeySchema": [
{
"AttributeName": "authenticationId",
"KeyType": "HASH"
}
],
"Projection": {
"ProjectionType": "ALL"
}
},
{
"IndexName": "clientId-userName-index",
"KeySchema": [
{
"AttributeName": "clientId",
"KeyType": "HASH"
},
{
"AttributeName": "userName",
"KeyType": "RANGE"
}
],
"Projection": {
"ProjectionType": "ALL"
}
},
{
"IndexName": "refreshToken-index",
"KeySchema": [
{
"AttributeName": "refreshToken",
"KeyType": "HASH"
}
],
"Projection": {
"ProjectionType": "ALL"
}
}
]
}
},
"OAuthCodeTable": {
"Type": "AWS::DynamoDB::Table",
"Properties": {
"TableName": "OAuthCode",
"AttributeDefinitions": [
{
"AttributeName": "code",
"AttributeType": "S"
}
],
"KeySchema": [
{
"AttributeName": "code",
"KeyType": "HASH"
}
],
"BillingMode": "PAY_PER_REQUEST"
}
},
"OAuthClientDetailsTable": {
"Type": "AWS::DynamoDB::Table",
"Properties": {
"TableName": "OAuthClientDetails",
"AttributeDefinitions": [
{
"AttributeName": "clientId",
"AttributeType": "S"
}
],
"KeySchema": [
{
"AttributeName": "clientId",
"KeyType": "HASH"
}
],
"BillingMode": "PAY_PER_REQUEST"
}
},
},
"Outputs": {
"AppURL": {
"Value": {
"Fn::Join": [
"",
[
"http://",
{
"Fn::GetAtt": [
"OAuthEnvironment",
"EndpointURL"
]
},
"/"
]
]
},
"Description": "URL for the working OAuth application"
},
"CodePipelineURL": {
"Value": {
"Fn::Join": [
"",
[
"https://console.aws.amazon.com/codepipeline/home?region=",
{
"Ref": "AWS::Region"
},
"#/view/",
{
"Ref": "CodePipelineStack"
}
]
]
},
"Description": "Pipeline URL"
},
"OAuthApplication": {
"Value": {
"Ref": "OAuthApplication"
}
},
"OAuthConfigurationTemplate": {
"Value": {
"Ref": "OAuthConfigurationTemplate"
},
"Description": "The Elastic Beanstalk configuration"
},
"OAuthEnvironment": {
"Value": {
"Ref": "OAuthEnvironment"
},
"Description": "The Elastic Beanstalk environment on which the application runs"
},
"OAuthApplicationRole": {
"Value": {
"Ref": "OAuthApplicationRole"
},
"Description": "The IAM role associated with CodePipeline pipeline"
}
}
}