I'm designing redis cluster using cloudformation template and during the validation of the template I'm facing this error "Template contains errors.: Template format error: JSON not well-formed. (line 151, column 2)"
Below is the cloudformation script
{
"AWSTemplateFormatVersion": "2010-09-09",
"Metadata": {
"AWS::CloudFormation::Designer": {
"f60e2d2e-b46b-48b1-88c8-eecce45d2166": {
"size": {
"width": 60,
"height": 60
},
"position": {
"x": 320,
"y": 70
},
"z": 2,
"parent": "71508a33-8207-4580-8721-c3688c4a0353",
"embeds": [],
"ismemberof": [
"a63aacbd-1c6e-4118-8bbe-08a5bc63052a",
"55eb37aa-e764-49ac-b8fe-3eddb2ea77ad"
]
},
"a63aacbd-1c6e-4118-8bbe-08a5bc63052a": {
"size": {
"width": 60,
"height": 60
},
"position": {
"x": 320,
"y": 160
},
"z": 2,
"parent": "71508a33-8207-4580-8721-c3688c4a0353",
"embeds": []
},
"0291abc8-9c50-491b-8400-e1f7f8b22118": {
"source": {
"id": "f60e2d2e-b46b-48b1-88c8-eecce45d2166"
},
"target": {
"id": "a63aacbd-1c6e-4118-8bbe-08a5bc63052a"
},
"z": 1
},
"55eb37aa-e764-49ac-b8fe-3eddb2ea77ad": {
"size": {
"width": 60,
"height": 60
},
"position": {
"x": 440,
"y": 70
},
"z": 2,
"parent": "71508a33-8207-4580-8721-c3688c4a0353",
"embeds": []
},
"7aa270dd-1131-4dc4-8913-dfaf44a3815d": {
"source": {
"id": "f60e2d2e-b46b-48b1-88c8-eecce45d2166"
},
"target": {
"id": "55eb37aa-e764-49ac-b8fe-3eddb2ea77ad"
},
"z": 2
},
"71508a33-8207-4580-8721-c3688c4a0353": {
"size": {
"width": 610,
"height": 600
},
"position": {
"x": 20,
"y": 10
},
"z": 1,
"embeds": [
"55eb37aa-e764-49ac-b8fe-3eddb2ea77ad",
"a63aacbd-1c6e-4118-8bbe-08a5bc63052a",
"f60e2d2e-b46b-48b1-88c8-eecce45d2166"
]
}
}
},
"Parameters" : {
"CacheNodeType" : {
"Description" : "The compute and memory capacity of the nodes in the Cache Cluster",
"Type" : "String",
"Default" : "cache.m3.medium",
"AllowedValues" : ["cache.t2.micro", "cache.t2.small", "cache.t2.medium",
"cache.m3.medium", "cache.m3.large", "cache.m3.xlarge", "cache.m3.2xlarge",
"cache.t1.micro", "cache.m1.small", "cache.m1.medium", "cache.m1.large",
"cache.m1.xlarge", "cache.c1.xlarge", "cache.r3.large", "cache.r3.xlarge",
"cache.r3.2xlarge", "cache.r3.4xlarge","cache.r3.8xlarge", "cache.m2.xlarge",
"cache.m2.2xlarge", "cache.m2.4xlarge"],
"ConstraintDescription" : "must select a valid Cache Node type."
}
},
"Resources": {
"RedisClusterReplicationGroup": {
"Type": "AWS::ElastiCache::ReplicationGroup",
"Properties": {
"CacheParameterGroupName": {
"Ref": "RedisClusterParameterGroup"
},
"CacheSubnetGroupName": {
"Ref": "RedisClusterSubnetGroup"
},
"CacheNodeType" : { "Ref" : "CacheNodeType" },
"Engine" : "redis",
"EngineVersion" : "2.8.24",
"NumCacheClusters" : 4,
"Port" : 6879,
"PreferredCacheClusterAZs" : ["us-east-1c","us-east-1d","us-east-1e"],
"ReplicationGroupDescription" : "RedisClusterReplicationGroup",
"SecurityGroupIds" : "sg-7ea72e07",
"SnapshotRetentionLimit" : 0,
"AutomaticFailoverEnabled" : true,
"Metadata": {
"AWS::CloudFormation::Designer": {
"id": "f60e2d2e-b46b-48b1-88c8-eecce45d2166"
}
}
},
"RedisClusterParameterGroup": {
"Type": "AWS::ElastiCache::ParameterGroup",
"Properties": {
"CacheParameterGroupFamily" : "redis2.8",
"CacheParameterGroupName" : "RedisClusterParameterGroup",
"Description" :"RedisClusterParameterGroup"
},
"Metadata": {
"AWS::CloudFormation::Designer": {
"id": "a63aacbd-1c6e-4118-8bbe-08a5bc63052a"
}
}
},
"RedisClusterSubnetGroup": {
"Type": "AWS::ElastiCache::SubnetGroup",
"Properties": {
"Description" : "RedisClusterSubnetGroups",
"SubnetIds" : ["subnet-7854ab20", "subnet-eaa7039c", "subnet-988a00a5"]
},
"Metadata": {
"AWS::CloudFormation::Designer": {
"id": "71508a33-8207-4580-8721-c3688c4a0353"
}
}
}
},
}
One way to avoid this whole set of JSON errors is to switch to YAML syntax, which is supported by Cloudformation. You can convert your JSON document to YAML at
https://www.json2yaml.com/
and then just use that. I find YAML much easier to maintain without the quotes, braces, and commas.
{
"AWSTemplateFormatVersion": "2010-09-09",
"Metadata": {
"AWS::CloudFormation::Designer": {
"f60e2d2e-b46b-48b1-88c8-eecce45d2166": {
"size": {
"width": 60,
"height": 60
},
"position": {
"x": 320,
"y": 70
},
"z": 2,
"parent": "71508a33-8207-4580-8721-c3688c4a0353",
"embeds": [],
"ismemberof": [
"a63aacbd-1c6e-4118-8bbe-08a5bc63052a",
"55eb37aa-e764-49ac-b8fe-3eddb2ea77ad"
]
},
"a63aacbd-1c6e-4118-8bbe-08a5bc63052a": {
"size": {
"width": 60,
"height": 60
},
"position": {
"x": 320,
"y": 160
},
"z": 2,
"parent": "71508a33-8207-4580-8721-c3688c4a0353",
"embeds": []
},
"0291abc8-9c50-491b-8400-e1f7f8b22118": {
"source": {
"id": "f60e2d2e-b46b-48b1-88c8-eecce45d2166"
},
"target": {
"id": "a63aacbd-1c6e-4118-8bbe-08a5bc63052a"
},
"z": 1
},
"55eb37aa-e764-49ac-b8fe-3eddb2ea77ad": {
"size": {
"width": 60,
"height": 60
},
"position": {
"x": 440,
"y": 70
},
"z": 2,
"parent": "71508a33-8207-4580-8721-c3688c4a0353",
"embeds": []
},
"7aa270dd-1131-4dc4-8913-dfaf44a3815d": {
"source": {
"id": "f60e2d2e-b46b-48b1-88c8-eecce45d2166"
},
"target": {
"id": "55eb37aa-e764-49ac-b8fe-3eddb2ea77ad"
},
"z": 2
},
"71508a33-8207-4580-8721-c3688c4a0353": {
"size": {
"width": 610,
"height": 600
},
"position": {
"x": 20,
"y": 10
},
"z": 1,
"embeds": [
"55eb37aa-e764-49ac-b8fe-3eddb2ea77ad",
"a63aacbd-1c6e-4118-8bbe-08a5bc63052a",
"f60e2d2e-b46b-48b1-88c8-eecce45d2166"
]
}
}
},
"Parameters": {
"CacheNodeType": {
"Description": "The compute and memory capacity of the nodes in the Cache Cluster",
"Type": "String",
"Default": "cache.m3.medium",
"AllowedValues": [
"cache.t2.micro",
"cache.t2.small",
"cache.t2.medium",
"cache.m3.medium",
"cache.m3.large",
"cache.m3.xlarge",
"cache.m3.2xlarge",
"cache.t1.micro",
"cache.m1.small",
"cache.m1.medium",
"cache.m1.large",
"cache.m1.xlarge",
"cache.c1.xlarge",
"cache.r3.large",
"cache.r3.xlarge",
"cache.r3.2xlarge",
"cache.r3.4xlarge",
"cache.r3.8xlarge",
"cache.m2.xlarge",
"cache.m2.2xlarge",
"cache.m2.4xlarge"
],
"ConstraintDescription": "must select a valid Cache Node type."
}
},
"Resources": {
"RedisClusterReplicationGroup": {
"Type": "AWS::ElastiCache::ReplicationGroup",
"Properties": {
"CacheParameterGroupName": {
"Ref": "RedisClusterParameterGroup"
},
"CacheSubnetGroupName": {
"Ref": "RedisClusterSubnetGroup"
},
"CacheNodeType": {
"Ref": "CacheNodeType"
},
"Engine": "redis",
"EngineVersion": "2.8.24",
"NumCacheClusters": 4,
"Port": 6879,
"PreferredCacheClusterAZs": [
"us-east-1c",
"us-east-1d",
"us-east-1e"
],
"ReplicationGroupDescription": "RedisClusterReplicationGroup",
"SecurityGroupIds": "sg-7ea72e07",
"SnapshotRetentionLimit": 0,
"AutomaticFailoverEnabled": true,
"Metadata": {
"AWS::CloudFormation::Designer": {
"id": "f60e2d2e-b46b-48b1-88c8-eecce45d2166"
}
}
}
},
"RedisClusterParameterGroup": {
"Type": "AWS::ElastiCache::ParameterGroup",
"Properties": {
"CacheParameterGroupFamily": "redis2.8",
"CacheParameterGroupName": "RedisClusterParameterGroup",
"Description": "RedisClusterParameterGroup"
},
"Metadata": {
"AWS::CloudFormation::Designer": {
"id": "a63aacbd-1c6e-4118-8bbe-08a5bc63052a"
}
}
},
"RedisClusterSubnetGroup": {
"Type": "AWS::ElastiCache::SubnetGroup",
"Properties": {
"Description": "RedisClusterSubnetGroups",
"SubnetIds": [
"subnet-7854ab20",
"subnet-eaa7039c",
"subnet-988a00a5"
]
},
"Metadata": {
"AWS::CloudFormation::Designer": {
"id": "71508a33-8207-4580-8721-c3688c4a0353"
}
}
}
}
}
Any JSON parser will tell you what the issue is. The last element need not have a ',' and the JSON needed one more '}' to get validated properly. I haven't checked if the script passes the cloudformation validation but, it passes the JSON parsing
Related
I am currently trying to wrap my head around how to use AWS CloudFormation service. This might be a really simple question, but I think it is very hard to understand the platform so far.
I followed Amazon's tutorial on how to create a basic web server. Going off the final template from there, I want to modify it to enable a user-defined VPC IP range. For this, I tried to add a VPC CIDR Block property, as well as modify the PublicSubnet settings to get a /24 subnet from the block property, but when trying to create a stack I get the following error message:
Here's the template I am trying to use:
{
"AWSTemplateFormatVersion": "2010-09-09",
"Description": "AWS CloudFormation Sample Template VPC_Single_Instance_In_Subnet: Sample template showing how to create a VPC and add an EC2 instance with an Elastic IP address and a security group. **WARNING** This template creates an Amazon EC2 instance. You will be billed for the AWS resources used if you create a stack from this template.",
"Parameters": {
"InstanceType": {
"Description": "WebServer EC2 instance type",
"Type": "String",
"Default": "t2.micro",
"AllowedValues": [
"t1.micro",
"t2.micro",
"t2.small",
"t2.medium"
],
"ConstraintDescription": "must be a valid EC2 instance type."
},
"KeyName": {
"Description": "Name of an existing EC2 KeyPair to enable SSH access to the instance.",
"Type": "AWS::EC2::KeyPair::KeyName",
"ConstraintDescription": "must be the name of an existing EC2 KeyPair."
},
"SSHLocation": {
"Description": " The IP address range that can be used access the web server using SSH.",
"Type": "String",
"MinLength": "9",
"MaxLength": "18",
"Default": "0.0.0.0/0",
"AllowedPattern": "(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})/(\\d{1,2})",
"ConstraintDescription": "must be a valid IP CIDR range of the form x.x.x.x/x."
}
},
"Mappings": {
"AWSInstanceType2Arch": {
"t1.micro": {"Arch": "PV64"},
"t2.micro": {"Arch": "HVM64"},
"t2.small": {"Arch": "HVM64"},
"t2.medium": {"Arch": "HVM64"}
},
"AWSRegionArch2AMI": {
"us-east-1": {
"PV64": "ami-1ccae774",
"HVM64": "ami-1ecae776",
"HVMG2": "ami-8c6b40e4"
}
}
},
"Resources": {
"VPC": {
"Type": "AWS::EC2::VPC",
"Properties": {
"EnableDnsSupport": "true",
"EnableDnsHostnames": "true",
"CidrBlock": "10.0.0.0/16"
},
"Metadata": {
"AWS::CloudFormation::Designer": {"id": "96a791f0-938b-4ebe-9f3c-b3fe2a588aee"}
}
},
"VpcCidrBlock": {
"Type": "AWS::EC2::VPCCidrBlock",
"Properties": {
"VpcId": {"Ref": "VPC"},
"CidrBlock": "10.0.0.0/16"
}
},
"PublicSubnet": {
"Type": "AWS::EC2::Subnet",
"Properties": {
"CidrBlock": { "Fn::Select" : [ "0", { "Fn::Cidr" : ["10.0.0.0/24", 1, 8 ]}]},
"VpcId": {"Ref": "VPC"}
},
"Metadata": {
"AWS::CloudFormation::Designer": {"id": "3df467ad-673c-4c48-a41c-3ac1626961e3"}
}
},
"InternetGateway": {
"Type": "AWS::EC2::InternetGateway",
"Metadata": {
"AWS::CloudFormation::Designer": {"id": "a166c4f5-7cc4-429b-b9d8-2c8c43facc63"}
}
},
"VPCGatewayAttachment": {
"Type": "AWS::EC2::VPCGatewayAttachment",
"Properties": {
"VpcId": {"Ref": "VPC"},
"InternetGatewayId": {"Ref": "InternetGateway"}
},
"Metadata": {
"AWS::CloudFormation::Designer": {"id": "1790ebeb-2e41-4293-8cc1-aaba134fd1e0"}
}
},
"PublicRouteTable": {
"Type": "AWS::EC2::RouteTable",
"Properties": {
"VpcId": {"Ref": "VPC"}
},
"Metadata": {
"AWS::CloudFormation::Designer": {"id": "175bad80-0988-4588-a919-331be705b02d"}
}
},
"PublicRoute": {
"Type": "AWS::EC2::Route",
"DependsOn": "VPCGatewayAttachment",
"Properties": {
"RouteTableId": {"Ref": "PublicRouteTable"},
"DestinationCidrBlock": "0.0.0.0/0",
"GatewayId": {"Ref": "InternetGateway"}
},
"Metadata": {
"AWS::CloudFormation::Designer": {"id": "143bbaa1-66a2-42a5-885f-e6300817103c"}
}
},
"PublicSubnetRouteTableAssociation": {
"Type": "AWS::EC2::SubnetRouteTableAssociation",
"Properties": {
"SubnetId": {"Ref": "PublicSubnet"},
"RouteTableId": {"Ref": "PublicRouteTable"}
},
"Metadata": {
"AWS::CloudFormation::Designer": {"id": "528e2b71-46e6-4e09-815a-f70630755219"}
}
},
"WebServerSecurityGroup": {
"Type": "AWS::EC2::SecurityGroup",
"Properties": {
"VpcId": {"Ref": "VPC"},
"GroupDescription": "Allow access from HTTP and SSH traffic",
"SecurityGroupIngress": [
{
"IpProtocol": "tcp",
"FromPort": "80",
"ToPort": "80",
"CidrIp": "0.0.0.0/0"
},
{
"IpProtocol": "tcp",
"FromPort": "22",
"ToPort": "22",
"CidrIp": {"Ref": "SSHLocation"}
}
]
},
"Metadata": {
"AWS::CloudFormation::Designer": {"id": "2e76192b-a4f8-48a5-92b6-abbfa8b83263"}
}
},
"WebServerInstance": {
"Type": "AWS::EC2::Instance",
"Metadata": {
"AWS::CloudFormation::Init": {
"configSets": {
"All": ["ConfigureSampleApp"]
},
"ConfigureSampleApp": {
"packages": {
"yum": {
"httpd": []
}
},
"files": {
"/var/www/html/index.html": {
"content": {
"Fn::Join": [
"\n",
["<h1>Congratulations, you have successfully launched the AWS CloudFormation sample.</h1>"]
]
},
"mode": "000644",
"owner": "root",
"group": "root"
}
},
"services": {
"sysvinit": {
"httpd": {
"enabled": "true",
"ensureRunning": "true"
}
}
}
}
},
"AWS::CloudFormation::Designer": {"id": "0f900c9e-1272-4ec2-8a42-790b074baa39"}
},
"Properties": {
"InstanceType": {"Ref": "InstanceType"},
"ImageId": {
"Fn::FindInMap": [
"AWSRegionArch2AMI",
{"Ref": "AWS::Region"},
{
"Fn::FindInMap": [
"AWSInstanceType2Arch",
{"Ref": "InstanceType"},
"Arch"
]
}
]
},
"KeyName": {"Ref": "KeyName"},
"NetworkInterfaces": [
{
"GroupSet": [
{"Ref": "WebServerSecurityGroup"}
],
"AssociatePublicIpAddress": "true",
"DeviceIndex": "0",
"DeleteOnTermination": "true",
"SubnetId": {"Ref": "PublicSubnet"}
}
],
"UserData": {
"Fn::Base64": {
"Fn::Join": [
"",
[
"#!/bin/bash -xe\n",
"yum update -y aws-cfn-bootstrap\n",
"# Install the files and packages from the metadata\n",
"/opt/aws/bin/cfn-init -v ",
" --stack ",
{"Ref": "AWS::StackName"},
" --resource WebServerInstance ",
" --configsets All ",
" --region ",
{"Ref": "AWS::Region"},
"\n",
"# Signal the status from cfn-init\n",
"/opt/aws/bin/cfn-signal -e $? ",
" --stack ",
{"Ref": "AWS::StackName"},
" --resource WebServerInstance ",
" --region ",
{"Ref": "AWS::Region"},
"\n"
]
]
}
}
},
"CreationPolicy": {
"ResourceSignal": {"Timeout": "PT5M"}
}
}
},
"Outputs": {
"URL": {
"Value": {
"Fn::Join": [
"",
[
"http://",
{
"Fn::GetAtt": [
"WebServerInstance",
"PublicIp"
]
}
]
]
},
"Description": "Newly created application URL"
},
"SubnetCIDR": {
"Value": {"Ref": "PublicSubnet"},
"Description": "Subnet for the application"
}
},
"Metadata": {
"AWS::CloudFormation::Designer": {
"a166c4f5-7cc4-429b-b9d8-2c8c43facc63": {
"size": {
"width": 60,
"height": 60
},
"position": {
"x": -40,
"y": 210
},
"z": 1,
"embeds": []
},
"96a791f0-938b-4ebe-9f3c-b3fe2a588aee": {
"size": {
"width": 320,
"height": 250
},
"position": {
"x": 70,
"y": 190
},
"z": 1,
"embeds": [
"2e76192b-a4f8-48a5-92b6-abbfa8b83263",
"175bad80-0988-4588-a919-331be705b02d"
]
},
"2e76192b-a4f8-48a5-92b6-abbfa8b83263": {
"size": {
"width": 60,
"height": 60
},
"position": {
"x": 280,
"y": 370
},
"z": 2,
"parent": "96a791f0-938b-4ebe-9f3c-b3fe2a588aee",
"embeds": []
},
"175bad80-0988-4588-a919-331be705b02d": {
"size": {
"width": 120,
"height": 120
},
"position": {
"x": 90,
"y": 230
},
"z": 2,
"parent": "96a791f0-938b-4ebe-9f3c-b3fe2a588aee",
"embeds": ["143bbaa1-66a2-42a5-885f-e6300817103c"]
},
"1790ebeb-2e41-4293-8cc1-aaba134fd1e0": {
"source": {"id": "a166c4f5-7cc4-429b-b9d8-2c8c43facc63"},
"target": {"id": "96a791f0-938b-4ebe-9f3c-b3fe2a588aee"},
"z": 1
},
"143bbaa1-66a2-42a5-885f-e6300817103c": {
"size": {
"width": 60,
"height": 60
},
"position": {
"x": 120,
"y": 260
},
"z": 3,
"parent": "175bad80-0988-4588-a919-331be705b02d",
"embeds": [],
"references": ["a166c4f5-7cc4-429b-b9d8-2c8c43facc63"],
"dependson": ["1790ebeb-2e41-4293-8cc1-aaba134fd1e0"],
"isrelatedto": ["a166c4f5-7cc4-429b-b9d8-2c8c43facc63"]
},
"3df467ad-673c-4c48-a41c-3ac1626961e3": {
"size": {
"width": 120,
"height": 120
},
"position": {
"x": 250,
"y": 230
},
"z": 0,
"embeds": ["0f900c9e-1272-4ec2-8a42-790b074baa39"]
},
"0f900c9e-1272-4ec2-8a42-790b074baa39": {
"size": {
"width": 60,
"height": 60
},
"position": {
"x": 280,
"y": 260
},
"z": 3,
"parent": "3df467ad-673c-4c48-a41c-3ac1626961e3",
"embeds": [],
"isrelatedto": ["2e76192b-a4f8-48a5-92b6-abbfa8b83263"]
},
"13e0e0da-40c9-45d0-8460-7732ed20d764": {
"source": {"id": "96a791f0-938b-4ebe-9f3c-b3fe2a588aee"},
"target": {"id": "3df467ad-673c-4c48-a41c-3ac1626961e3"},
"z": 2
},
"528e2b71-46e6-4e09-815a-f70630755219": {
"source": {"id": "175bad80-0988-4588-a919-331be705b02d"},
"target": {"id": "3df467ad-673c-4c48-a41c-3ac1626961e3"},
"z": 2
}
}
}
}
You don't need AWS::EC2::VPCCidrBlock. Instead you add VPCCidr parameter to your template and use that:
{
"AWSTemplateFormatVersion": "2010-09-09",
"Description": "AWS CloudFormation Sample Template VPC_Single_Instance_In_Subnet: Sample template showing how to create a VPC and add an EC2 instance with an Elastic IP address and a security group. **WARNING** This template creates an Amazon EC2 instance. You will be billed for the AWS resources used if you create a stack from this template.",
"Parameters": {
"InstanceType": {
"Description": "WebServer EC2 instance type",
"Type": "String",
"Default": "t2.micro",
"AllowedValues": [
"t1.micro",
"t2.micro",
"t2.small",
"t2.medium"
],
"ConstraintDescription": "must be a valid EC2 instance type."
},
"KeyName": {
"Description": "Name of an existing EC2 KeyPair to enable SSH access to the instance.",
"Type": "AWS::EC2::KeyPair::KeyName",
"ConstraintDescription": "must be the name of an existing EC2 KeyPair."
},
"VPCCidr": {
"Type": "String",
"Default": "10.0.0.0/16"
},
"SSHLocation": {
"Description": " The IP address range that can be used access the web server using SSH.",
"Type": "String",
"MinLength": "9",
"MaxLength": "18",
"Default": "0.0.0.0/0",
"AllowedPattern": "(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})/(\\d{1,2})",
"ConstraintDescription": "must be a valid IP CIDR range of the form x.x.x.x/x."
}
},
"Mappings": {
"AWSInstanceType2Arch": {
"t1.micro": {"Arch": "PV64"},
"t2.micro": {"Arch": "HVM64"},
"t2.small": {"Arch": "HVM64"},
"t2.medium": {"Arch": "HVM64"}
},
"AWSRegionArch2AMI": {
"us-east-1": {
"PV64": "ami-1ccae774",
"HVM64": "ami-1ecae776",
"HVMG2": "ami-8c6b40e4"
}
}
},
"Resources": {
"VPC": {
"Type": "AWS::EC2::VPC",
"Properties": {
"EnableDnsSupport": "true",
"EnableDnsHostnames": "true",
"CidrBlock": {"Ref": "VPCCidr"}
},
"Metadata": {
"AWS::CloudFormation::Designer": {"id": "96a791f0-938b-4ebe-9f3c-b3fe2a588aee"}
}
},
"PublicSubnet": {
"Type": "AWS::EC2::Subnet",
"Properties": {
"CidrBlock": { "Fn::Select" : [ "0", { "Fn::Cidr" : [{"Ref": "VPCCidr"}, 1, 8 ]}]},
"VpcId": {"Ref": "VPC"}
},
"Metadata": {
"AWS::CloudFormation::Designer": {"id": "3df467ad-673c-4c48-a41c-3ac1626961e3"}
}
},
"InternetGateway": {
"Type": "AWS::EC2::InternetGateway",
"Metadata": {
"AWS::CloudFormation::Designer": {"id": "a166c4f5-7cc4-429b-b9d8-2c8c43facc63"}
}
},
"VPCGatewayAttachment": {
"Type": "AWS::EC2::VPCGatewayAttachment",
"Properties": {
"VpcId": {"Ref": "VPC"},
"InternetGatewayId": {"Ref": "InternetGateway"}
},
"Metadata": {
"AWS::CloudFormation::Designer": {"id": "1790ebeb-2e41-4293-8cc1-aaba134fd1e0"}
}
},
"PublicRouteTable": {
"Type": "AWS::EC2::RouteTable",
"Properties": {
"VpcId": {"Ref": "VPC"}
},
"Metadata": {
"AWS::CloudFormation::Designer": {"id": "175bad80-0988-4588-a919-331be705b02d"}
}
},
"PublicRoute": {
"Type": "AWS::EC2::Route",
"DependsOn": "VPCGatewayAttachment",
"Properties": {
"RouteTableId": {"Ref": "PublicRouteTable"},
"DestinationCidrBlock": "0.0.0.0/0",
"GatewayId": {"Ref": "InternetGateway"}
},
"Metadata": {
"AWS::CloudFormation::Designer": {"id": "143bbaa1-66a2-42a5-885f-e6300817103c"}
}
},
"PublicSubnetRouteTableAssociation": {
"Type": "AWS::EC2::SubnetRouteTableAssociation",
"Properties": {
"SubnetId": {"Ref": "PublicSubnet"},
"RouteTableId": {"Ref": "PublicRouteTable"}
},
"Metadata": {
"AWS::CloudFormation::Designer": {"id": "528e2b71-46e6-4e09-815a-f70630755219"}
}
},
"WebServerSecurityGroup": {
"Type": "AWS::EC2::SecurityGroup",
"Properties": {
"VpcId": {"Ref": "VPC"},
"GroupDescription": "Allow access from HTTP and SSH traffic",
"SecurityGroupIngress": [
{
"IpProtocol": "tcp",
"FromPort": "80",
"ToPort": "80",
"CidrIp": "0.0.0.0/0"
},
{
"IpProtocol": "tcp",
"FromPort": "22",
"ToPort": "22",
"CidrIp": {"Ref": "SSHLocation"}
}
]
},
"Metadata": {
"AWS::CloudFormation::Designer": {"id": "2e76192b-a4f8-48a5-92b6-abbfa8b83263"}
}
},
"WebServerInstance": {
"Type": "AWS::EC2::Instance",
"Metadata": {
"AWS::CloudFormation::Init": {
"configSets": {
"All": ["ConfigureSampleApp"]
},
"ConfigureSampleApp": {
"packages": {
"yum": {
"httpd": []
}
},
"files": {
"/var/www/html/index.html": {
"content": {
"Fn::Join": [
"\n",
["<h1>Congratulations, you have successfully launched the AWS CloudFormation sample.</h1>"]
]
},
"mode": "000644",
"owner": "root",
"group": "root"
}
},
"services": {
"sysvinit": {
"httpd": {
"enabled": "true",
"ensureRunning": "true"
}
}
}
}
},
"AWS::CloudFormation::Designer": {"id": "0f900c9e-1272-4ec2-8a42-790b074baa39"}
},
"Properties": {
"InstanceType": {"Ref": "InstanceType"},
"ImageId": {
"Fn::FindInMap": [
"AWSRegionArch2AMI",
{"Ref": "AWS::Region"},
{
"Fn::FindInMap": [
"AWSInstanceType2Arch",
{"Ref": "InstanceType"},
"Arch"
]
}
]
},
"KeyName": {"Ref": "KeyName"},
"NetworkInterfaces": [
{
"GroupSet": [
{"Ref": "WebServerSecurityGroup"}
],
"AssociatePublicIpAddress": "true",
"DeviceIndex": "0",
"DeleteOnTermination": "true",
"SubnetId": {"Ref": "PublicSubnet"}
}
],
"UserData": {
"Fn::Base64": {
"Fn::Join": [
"",
[
"#!/bin/bash -xe\n",
"yum update -y aws-cfn-bootstrap\n",
"# Install the files and packages from the metadata\n",
"/opt/aws/bin/cfn-init -v ",
" --stack ",
{"Ref": "AWS::StackName"},
" --resource WebServerInstance ",
" --configsets All ",
" --region ",
{"Ref": "AWS::Region"},
"\n",
"# Signal the status from cfn-init\n",
"/opt/aws/bin/cfn-signal -e $? ",
" --stack ",
{"Ref": "AWS::StackName"},
" --resource WebServerInstance ",
" --region ",
{"Ref": "AWS::Region"},
"\n"
]
]
}
}
},
"CreationPolicy": {
"ResourceSignal": {"Timeout": "PT5M"}
}
}
},
"Outputs": {
"URL": {
"Value": {
"Fn::Join": [
"",
[
"http://",
{
"Fn::GetAtt": [
"WebServerInstance",
"PublicIp"
]
}
]
]
},
"Description": "Newly created application URL"
},
"SubnetCIDR": {
"Value": {"Ref": "PublicSubnet"},
"Description": "Subnet for the application"
}
},
"Metadata": {
"AWS::CloudFormation::Designer": {
"a166c4f5-7cc4-429b-b9d8-2c8c43facc63": {
"size": {
"width": 60,
"height": 60
},
"position": {
"x": -40,
"y": 210
},
"z": 1,
"embeds": []
},
"96a791f0-938b-4ebe-9f3c-b3fe2a588aee": {
"size": {
"width": 320,
"height": 250
},
"position": {
"x": 70,
"y": 190
},
"z": 1,
"embeds": [
"2e76192b-a4f8-48a5-92b6-abbfa8b83263",
"175bad80-0988-4588-a919-331be705b02d"
]
},
"2e76192b-a4f8-48a5-92b6-abbfa8b83263": {
"size": {
"width": 60,
"height": 60
},
"position": {
"x": 280,
"y": 370
},
"z": 2,
"parent": "96a791f0-938b-4ebe-9f3c-b3fe2a588aee",
"embeds": []
},
"175bad80-0988-4588-a919-331be705b02d": {
"size": {
"width": 120,
"height": 120
},
"position": {
"x": 90,
"y": 230
},
"z": 2,
"parent": "96a791f0-938b-4ebe-9f3c-b3fe2a588aee",
"embeds": ["143bbaa1-66a2-42a5-885f-e6300817103c"]
},
"1790ebeb-2e41-4293-8cc1-aaba134fd1e0": {
"source": {"id": "a166c4f5-7cc4-429b-b9d8-2c8c43facc63"},
"target": {"id": "96a791f0-938b-4ebe-9f3c-b3fe2a588aee"},
"z": 1
},
"143bbaa1-66a2-42a5-885f-e6300817103c": {
"size": {
"width": 60,
"height": 60
},
"position": {
"x": 120,
"y": 260
},
"z": 3,
"parent": "175bad80-0988-4588-a919-331be705b02d",
"embeds": [],
"references": ["a166c4f5-7cc4-429b-b9d8-2c8c43facc63"],
"dependson": ["1790ebeb-2e41-4293-8cc1-aaba134fd1e0"],
"isrelatedto": ["a166c4f5-7cc4-429b-b9d8-2c8c43facc63"]
},
"3df467ad-673c-4c48-a41c-3ac1626961e3": {
"size": {
"width": 120,
"height": 120
},
"position": {
"x": 250,
"y": 230
},
"z": 0,
"embeds": ["0f900c9e-1272-4ec2-8a42-790b074baa39"]
},
"0f900c9e-1272-4ec2-8a42-790b074baa39": {
"size": {
"width": 60,
"height": 60
},
"position": {
"x": 280,
"y": 260
},
"z": 3,
"parent": "3df467ad-673c-4c48-a41c-3ac1626961e3",
"embeds": [],
"isrelatedto": ["2e76192b-a4f8-48a5-92b6-abbfa8b83263"]
},
"13e0e0da-40c9-45d0-8460-7732ed20d764": {
"source": {"id": "96a791f0-938b-4ebe-9f3c-b3fe2a588aee"},
"target": {"id": "3df467ad-673c-4c48-a41c-3ac1626961e3"},
"z": 2
},
"528e2b71-46e6-4e09-815a-f70630755219": {
"source": {"id": "175bad80-0988-4588-a919-331be705b02d"},
"target": {"id": "3df467ad-673c-4c48-a41c-3ac1626961e3"},
"z": 2
}
}
}
}
As per the documentation provided in Cloud Vision Docs the BoundingPoly object in the blocks array should have a format like this
{
"vertices": [
{
object (Vertex)
}
],
"normalizedVertices": [
{
object (NormalizedVertex)
}
]
}
But when we tried https://vision.googleapis.com/v1/files:annotate?key=xxxxxx to perform OCR on a PDF file with the request:
{
"requests": [{
"inputConfig": {
"content": "encoded content",
"mimeType": "application/pdf"
},
"features": [{
"type": "DOCUMENT_TEXT_DETECTION",
"maxResults": 50
}]
}]
}
the response from server was
{
"responses": [
{
"responses": [
{
"fullTextAnnotation": {
"pages": [
{
"property": {
"detectedLanguages": [
{
"languageCode": "en",
"confidence": 0.65
},
{
"languageCode": "fil",
"confidence": 0.01
}
]
},
"width": 841,
"height": 595,
"blocks": [
{
"property": {
"detectedLanguages": [
{
"languageCode": "en",
"confidence": 1
}
]
},
"boundingBox": {
"normalizedVertices": [
{
"x": 0.4351962,
"y": 0.057142857
},
{
"x": 0.6052319,
"y": 0.057142857
},
{
"x": 0.6052319,
"y": 0.08571429
},
{
"x": 0.4351962,
"y": 0.08571429
}
]
},
"paragraphs": [
{
"property": {
"detectedLanguages": [
{
"languageCode": "en",
"confidence": 1
}
]
},
"boundingBox": {
"normalizedVertices": [
{
"x": 0.4351962,
"y": 0.057142857
},
{
"x": 0.6052319,
"y": 0.057142857
},
{
"x": 0.6052319,
"y": 0.08571429
},
{
"x": 0.4351962,
"y": 0.08571429
}
]
},
"words": [
{
"property": {
"detectedLanguages": [
{
"languageCode": "en"
}
]
},
"boundingBox": {
"normalizedVertices": [
{
"x": 0.4351962,
"y": 0.057142857
},
{
"x": 0.49346018,
"y": 0.057142857
},
{
"x": 0.49346018,
"y": 0.08571429
},
{
"x": 0.4351962,
"y": 0.08571429
}
]
},
"symbols": [
{
"property": {
"detectedLanguages": [
{
"languageCode": "en"
}
]
},
"text": "F",
"confidence": 0.99
},
{
"property": {
"detectedLanguages": [
{
"languageCode": "en"
}
]
},
"text": "a",
"confidence": 1
},
{
"property": {
"detectedLanguages": [
{
"languageCode": "en"
}
]
},
"text": "c",
"confidence": 0.99
},
{
"property": {
"detectedLanguages": [
{
"languageCode": "en"
}
]
},
"text": "t",
"confidence": 0.99
},
{
"property": {
"detectedLanguages": [
{
"languageCode": "en"
}
]
},
"text": "o",
"confidence": 1
},
{
"property": {
"detectedLanguages": [
{
"languageCode": "en"
}
]
},
"text": "r",
"confidence": 1
},
{
"property": {
"detectedLanguages": [
{
"languageCode": "en"
}
],
"detectedBreak": {
"type": "SPACE"
}
},
"text": "y",
"confidence": 1
}
],
"confidence": 0.99
},
{
"property": {
"detectedLanguages": [
{
"languageCode": "en"
}
]
},
"text": "i",
"confidence": 0.99
},
{
"property": {
"detectedLanguages": [
{
"languageCode": "en"
}
]
},
"text": "n",
"confidence": 1
},
{
"property": {
"detectedLanguages": [
{
"languageCode": "en"
}
],
"detectedBreak": {
"type": "SPACE"
}
},
"text": "g",
"confidence": 1
}
],
"confidence": 0.99
},
{
"property": {
"detectedLanguages": [
{
"languageCode": "en"
}
]
},
"boundingBox": {
"normalizedVertices": [
{
"x": 0.57431626,
"y": 0.057142857
},
{
"x": 0.6052319,
"y": 0.057142857
},
{
"x": 0.6052319,
"y": 0.08571429
},
{
"x": 0.57431626,
"y": 0.08571429
}
]
},
"symbols": [
{
"property": {
"detectedLanguages": [
{
"languageCode": "en"
}
]
},
"text": "L",
"confidence": 0.99
},
{
"property": {
"detectedLanguages": [
{
"languageCode": "en"
}
]
},
"text": "i",
"confidence": 0.99
},
{
"property": {
"detectedLanguages": [
{
"languageCode": "en"
}
]
},
"text": "s",
"confidence": 0.99
},
{
"property": {
"detectedLanguages": [
{
"languageCode": "en"
}
],
"detectedBreak": {
"type": "LINE_BREAK"
}
},
"text": "t",
"confidence": 1
}
],
"confidence": 0.99
}
],
"confidence": 0.99
}
],
"blockType": "TEXT",
"confidence": 0.99
}
Is there anything to be considered if the vertices object is missing in the BoundingPoly object(boundingBox) property in the above json
When tried in the drag & drop demo, the json response for the OCR done on an image was
"fullTextAnnotation": {
"pages": [
{
"blocks": [
{
"blockType": "TEXT",
"boundingBox": {
"vertices": [
{
"x": 31,
"y": 63
},
{
"x": 147,
"y": 63
},
{
"x": 147,
"y": 81
},
{
"x": 31,
"y": 81
}
]
},
"confidence": 0.99,
"paragraphs": [
{
"boundingBox": {
"vertices": [
{
"x": 31,
"y": 63
},
{
"x": 147,
"y": 63
},
{
"x": 147,
"y": 81
},
{
"x": 31,
"y": 81
}
]
},
Is this the intended behavior or any issues ? which field we should follow normalizedVertices or vertices !!
The difference is that, in the request made from the code you're sending a PDF. In the drag & drop demo, you're sending an image (the demo doesn't accept files).
I replicated this and the behavior seems to be constant: PDF files are annotated with NormalizedVertices, whereas images are annotated with Vertices. My guess is that this is the intended behavior to enhance the performance of large PDF files annotation requests (large due to number of pages).
I sent a request to the Google Documentation so they can add this information in their docs.
I am calling the Amazon Rekognition Detect faces API from Post man. I pass the image as base64 and pass the "Attributes" as ["ALL"].
{
"Image": {
"Attributes": ["ALL"],
"Bytes": <base64 image>
}
}
The response I get is as below. You can see that it has only a few attributes and does not include age range, beard, glasses etc. Same set of attributes are returned irrespective of whether I pass the value as "ALL", or "DEFAULT" or "ALL","DEFAULT" in the Attributes parameter.
Am I missing something here? Any pointers would be much appreciated.
{
"FaceDetails": [
{
"BoundingBox": {
"Height": 0.49429410696029663,
"Left": 0.35876789689064026,
"Top": 0.15820752084255219,
"Width": 0.3210359811782837
},
"Confidence": 100.0,
"Landmarks": [
{
"Type": "eyeLeft",
"X": 0.4103875756263733,
"Y": 0.35949569940567017
},
{
"Type": "eyeRight",
"X": 0.5616039037704468,
"Y": 0.3441786468029022
},
{
"Type": "mouthLeft",
"X": 0.4385274350643158,
"Y": 0.5330458879470825
},
{
"Type": "mouthRight",
"X": 0.5625125169754028,
"Y": 0.5202205181121826
},
{
"Type": "nose",
"X": 0.48630291223526,
"Y": 0.436920166015625
}
],
"Pose": {
"Pitch": 8.636483192443848,
"Roll": -5.8078813552856445,
"Yaw": -3.338975429534912
},
"Quality": {
"Brightness": 82.37736511230469,
"Sharpness": 83.14741516113281
}
}
]
}
I've created this custom visual wrapper of ag-grid, as first foray/investigation into custom visual development
https://gitlab.com/nite2/powerbi-ag-grid
It's pretty bare-bones currently, only using the table data mapping - which doesnt allow the dashboard developer to control the powerful row grouping & pivoting that ag-grid provides. I had a crack at using the matrix data mapping, however it is clearly built without open community custom visual devs in mind, eg with lack of documentation and posts like this:
https://community.powerbi.com/t5/Developer/Need-Help-understanding-Matrix-dataMapping/td-p/225967
Can anyone suggest a decent resource to quickly understand the matrix mapping, so I can map it into something simple & useful for ag-grid to consume (in the form of ag-grid ColumnDefs)? Or another open-source example of a matrix data mapping custom viz with some example javascript manipulation of the matrix dataview?
If you add the grid (published into the dist folder in gitlab) then you should see a columns sidebar in the grid itself, which should allow you to play with the grid pivot, or just go to https://www.ag-grid.com/example.php
(Related: I also cant seem to log in to https://community.powerbi.com, have an infinite redirect between it and https://login.microsoftonline.com - have tried every browser, osx & windows - cleared all cookies on both, turned off any adblocks & do not track - any suggestions?)
Here's an example of a capabilities.json that I've written to map a matrix to four inputs from Power Bi (two as grouping; two as measures):
{
"dataRoles": [
{
"name": "Series",
"kind": "Grouping",
"displayName": "Legend and Index",
"displayNameKey": "Role_DisplayName_Legend"
},
{
"name": "X",
"kind": "Measure",
"displayName": "X Axis",
"displayNameKey": "Role_DisplayName_X"
},
{
"name": "Y",
"kind": "Measure",
"displayName": "Y Axis",
"displayNameKey": "Role_DisplayName_Y"
},
{
"name": "Size",
"kind": "Measure",
"displayName": "Size",
"displayNameKey": "Role_DisplayName_Size"
},
{
"name": "Gradient",
"kind": "Measure",
"displayName": "Color saturation",
"displayNameKey": "Role_DisplayName_Gradient"
},
{
"name": "ColorFill",
"kind": "Grouping",
"displayName": "Customized Color",
"displayNameKey": "Role_DisplayName_CustomizedColor"
},
{
"name": "Shape",
"kind": "Measure",
"displayName": "Shape",
"displayNameKey": "Role_DisplayName_Shape"
},
{
"name": "Image",
"kind": "Grouping",
"displayName": "Image",
"displayNameKey": "Role_DisplayName_Image"
},
{
"name": "Rotation",
"kind": "Measure",
"displayName": "Rotation",
"displayNameKey": "Role_DisplayName_Rotation"
},
{
"name": "Backdrop",
"kind": "Grouping",
"displayName": "Backdrop",
"displayNameKey": "Role_DisplayName_Backdrop"
},
{
"name": "X Start",
"kind": "Measure",
"displayName": "X Start",
"displayNameKey": "Role_DisplayName_XStart"
},
{
"name": "X End",
"kind": "Measure",
"displayName": "X End",
"displayNameKey": "Role_DisplayName_XEnd"
},
{
"name": "Y Start",
"kind": "Measure",
"displayName": "Y Start",
"displayNameKey": "Role_DisplayName_YStart"
},
{
"name": "Y End",
"kind": "Measure",
"displayName": "Y End",
"displayNameKey": "Role_DisplayName_YEnd"
}
],
"dataViewMappings": [{
"conditions": [
{
"Series": { "max": 2 }, "X": { "max": 1 }, "Y": { "max": 1 }, "Size": { "max": 1 }, "Gradient": { "max": 1 }, "ColorFill": { "max": 0 },
"Shape": { "max": 1 }, "Image": { "max": 0 }, "Rotation": { "max": 1 }, "Backdrop": { "max": 1 }, "XStart": { "max": 1 },
"XEnd": { "max": 1 }, "YStart": { "max": 1 }, "YEnd": { "max": 1 }
},
{
"Series": { "max": 2 }, "X": { "max": 1 }, "Y": { "max": 1 }, "Size": { "max": 1 }, "Gradient": { "max": 0 }, "ColorFill": { "max": 1 },
"Shape": { "max": 1 }, "Image": { "max": 0 }, "Rotation": { "max": 1 }, "Backdrop": { "max": 1 }, "XStart": { "max": 1 },
"End": { "max": 1 }, "YStart": { "max": 1 }, "YEnd": { "max": 1 }
},
{
"Series": { "max": 2 }, "X": { "max": 1 }, "Y": { "max": 1 }, "Size": { "max": 1 }, "Gradient": { "max": 0 }, "ColorFill": { "max": 0 },
"Shape": { "max": 0 }, "Image": { "max": 1 }, "Rotation": { "max": 1 }, "Backdrop": { "max": 1 }, "XStart": { "max": 1 },
"XEnd": { "max": 1 }, "YStart": { "max": 1 }, "YEnd": { "max": 1 }
},
{
"Series": { "max": 2 }, "X": { "max": 1 }, "Y": { "max": 1 }, "Size": { "max": 1 }, "Gradient": { "max": 0 }, "ColorFill": { "max": 1 },
"Shape": { "max": 1 }, "Image": { "max": 0 }, "Rotation": { "max": 1 }, "Backdrop": { "max": 1 }, "XStart": { "max": 1 },
"XEnd": { "max": 1 }, "YStart": { "max": 1 }, "YEnd": { "max": 1 }
},
{
"Series": { "max": 2 }, "X": { "max": 1 }, "Y": { "max": 1 }, "Size": { "max": 1 }, "Gradient": { "max": 0 }, "ColorFill": { "max": 0 },
"Shape": { "max": 0 }, "Image": { "max": 1 }, "Rotation": { "max": 1 }, "Backdrop": {"max": 1 }, "XStart": { "max": 1 },
"XEnd": { "max": 1 }, "YStart": { "max": 1 }, "YEnd": { "max": 1 }
}
],
"matrix": {
"rows": {
"for": {
"in": "Series"
},
"dataReductionAlgorithm": {
"sample": {
"count": 70000
}
}
},
"columns": {
"for": {
"in": "Category"
},
"dataReductionAlgorithm": {
"top": {
"count": 3
}
}
},
"values": {
"select": [
{
"bind": {
"to": "X"
}
},
{
"bind": {
"to": "Y"
}
}
]
},
"sorting": {
"implicit": {
"clauses": [
{
"role": "Series",
"direction": 1
}
]
}
}
}
}],
"objects": {
"dataPoint": {
"displayName": "Data colors",
"displayNameKey": "Visual_DataPoint",
"properties": {
"defaultColor": {
"displayName": "Default color",
"displayNameKey": "Visual_DefaultColor",
"type": {
"fill": {
"solid": {
"color": true
}
}
}
},
"showAllDataPoints": {
"displayName": "Show all",
"displayNameKey": "Visual_DataPoint_Show_All",
"type": {
"bool": true
}
},
"fill": {
"displayName": "Fill",
"displayNameKey": "Visual_Fill",
"type": {
"fill": {
"solid": {
"color": true
}
}
}
},
"fillRule": {
"displayName": "Color saturation",
"displayNameKey": "Visual_ColorSaturation",
"type": {
"fillRule": {}
},
"rule": {
"inputRole": "Gradient",
"output": {
"property": "fill",
"selector": [
"Category"
]
}
}
}
}
},
"categoryAxis": {
"displayName": "X-Axis",
"displayNameKey": "Visual_XAxis",
"properties": {
"show": {
"displayName": "Show",
"displayNameKey": "Visual_Show",
"type": {
"bool": true
}
},
"start": {
"displayName": "Start",
"displayNameKey": "Visual_Axis_Start",
"type": {
"numeric": true
}
},
"end": {
"displayName": "End",
"displayNameKey": "Visual_Axis_End",
"type": {
"numeric": true
}
},
"showAxisTitle": {
"displayName": "Title",
"displayNameKey": "Visual_Axis_Title",
"type": {
"bool": true
}
},
"axisColor": {
"displayName": "Color",
"displayNameKey": "Visual_Axis_LabelColor",
"type": {
"fill": {
"solid": {
"color": true
}
}
}
},
"labelDisplayUnits": {
"displayName": "Display units",
"displayNameKey": "Visual_DisplayUnits",
"type": {
"formatting": {
"labelDisplayUnits": true
}
}
}
}
},
"valueAxis": {
"displayName": "Y-Axis",
"displayNameKey": "Visual_YAxis",
"properties": {
"show": {
"displayName": "Show",
"displayNameKey": "Visual_Show",
"type": {
"bool": true
}
},
"start": {
"displayName": "Start",
"displayNameKey": "Visual_Axis_Start",
"type": {
"numeric": true
}
},
"end": {
"displayName": "End",
"displayNameKey": "Visual_Axis_End",
"type": {
"numeric": true
}
},
"showAxisTitle": {
"displayName": "Title",
"displayNameKey": "Visual_Axis_Title",
"type": {
"bool": true
}
},
"axisColor": {
"displayName": "Color",
"displayNameKey": "Visual_Axis_LabelColor",
"type": {
"fill": {
"solid": {
"color": true
}
}
}
},
"labelDisplayUnits": {
"displayName": "Display units",
"displayNameKey": "Visual_DisplayUnits",
"type": {
"formatting": {
"labelDisplayUnits": true
}
}
}
}
},
"legend": {
"displayName": "Legend",
"displayNameKey": "Visual_Legend",
"properties": {
"show": {
"displayName": "Show",
"displayNameKey": "Visual_Show",
"type": {
"bool": true
}
},
"position": {
"displayName": "Position",
"displayNameKey": "Visual_LegendPosition",
"description": "Select the location for the legend",
"descriptionKey": "Visual_Description_LegendPosition",
"type": {
"enumeration": [
{
"value": "Top",
"displayName": "Top",
"displayNameKey": "Visual_LegendPosition_Top"
},
{
"value": "Bottom",
"displayName": "Bottom",
"displayNameKey": "Visual_LegendPosition_Bottom"
},
{
"value": "Left",
"displayName": "Left",
"displayNameKey": "Visual_LegendPosition_Left"
},
{
"value": "Right",
"displayName": "Right",
"displayNameKey": "Visual_LegendPosition_Right"
},
{
"value": "TopCenter",
"displayName": "Top Center",
"displayNameKey": "Visual_LegendPosition_TopCenter"
},
{
"value": "BottomCenter",
"displayName": "Bottom Center",
"displayNameKey": "Visual_LegendPosition_BottomCenter"
},
{
"value": "LeftCenter",
"displayName": "Left Center",
"displayNameKey": "Visual_LegendPosition_LeftCenter"
},
{
"value": "RightCenter",
"displayName": "Right center",
"displayNameKey": "Visual_LegendPosition_RightCenter"
}
]
}
},
"showTitle": {
"displayName": "Title",
"displayNameKey": "Visual_LegendShowTitle",
"description": "Display a title for legend symbols",
"descriptionKey": "Visual_Description_LegendShowTitle",
"type": {
"bool": true
}
},
"titleText": {
"displayName": "Legend Name",
"displayNameKey": "Visual_LegendName",
"description": "Title text",
"descriptionKey": "Visual_Description_LegendName",
"type": {
"text": true
}
},
"labelColor": {
"displayName": "Color",
"displayNameKey": "Visual_LegendTitleColor",
"type": {
"fill": {
"solid": {
"color": true
}
}
}
},
"fontSize": {
"displayName": "Text Size",
"displayNameKey": "Visual_TextSize",
"type": {
"formatting": {
"fontSize": true
}
}
}
}
},
"categoryLabels": {
"displayName": "Category labels",
"displayNameKey": "Visual_CategoryLabels",
"properties": {
"show": {
"displayName": "Show",
"displayNameKey": "Visual_Show",
"type": {
"bool": true
}
},
"color": {
"displayName": "Color",
"displayNameKey": "Visual_LabelsFill",
"type": {
"fill": {
"solid": {
"color": true
}
}
}
},
"fontSize": {
"displayName": "Text Size",
"displayNameKey": "Visual_TextSize",
"type": {
"formatting": {
"fontSize": true
}
}
}
}
},
"fillPoint": {
"displayName": "Fill point",
"displayNameKey": "Visual_FillPoint",
"properties": {
"show": {
"displayName": "Fill",
"displayNameKey": "Visual_Fill",
"type": {
"bool": true
}
}
}
},
"backdrop": {
"displayName": "Backdrop",
"displayNameKey": "Visual_Backdrop",
"properties": {
"show": {
"displayName": "Show",
"displayNameKey": "Visual_Show",
"type": {
"bool": true
}
},
"url": {
"displayName": "Image URL",
"displayNameKey": "Visual_Backdrop_ImageURL",
"type": {
"text": true
}
}
}
},
"crosshair": {
"displayName": "Crosshair",
"displayNameKey": "Visual_Crosshair",
"properties": {
"show": {
"displayName": "Crosshair",
"displayNameKey": "Visual_Crosshair",
"type": {
"bool": true
}
}
}
},
"outline": {
"displayName": "Outline",
"displayNameKey": "Visual_Outline",
"properties": {
"show": {
"displayName": "Outline",
"displayNameKey": "Visual_Outline",
"type": {
"bool": true
}
}
}
}
},
"supportsMultiVisualSelection": true
}
I’m new using Amazon Rekognition to analyze faces on a video.
I’m using startFaceSearch to start my analysis. After the job is completed successfully, I’m using the JobId generated to call getFaceSearch.
On my first video analyzed, the results were as expected. But when I analyze the second example some strange behavior occurs and I can’t understand why.
Viewing the JSON generated as results for my second video, completely different faces are identified with the same index number.
Please see the results below.
{
"Timestamp": 35960,
"Person": {
"Index": 11,
"BoundingBox": {
"Width": 0.09375,
"Height": 0.24583333730698,
"Left": 0.1875,
"Top": 0.375
},
"Face": {
"BoundingBox": {
"Width": 0.06993006914854,
"Height": 0.10256410390139,
"Left": 0.24475525319576,
"Top": 0.375
},
"Landmarks": [
{
"Type": "eyeLeft",
"X": 0.26899611949921,
"Y": 0.40649232268333
},
{
"Type": "eyeRight",
"X": 0.28330621123314,
"Y": 0.41610333323479
},
{
"Type": "nose",
"X": 0.27063181996346,
"Y": 0.43293061852455
},
{
"Type": "mouthLeft",
"X": 0.25983560085297,
"Y": 0.44362303614616
},
{
"Type": "mouthRight",
"X": 0.27296212315559,
"Y": 0.44758656620979
}
],
"Pose": {
"Roll": 22.106262207031,
"Yaw": 6.3516845703125,
"Pitch": -6.2676968574524
},
"Quality": {
"Brightness": 41.875026702881,
"Sharpness": 65.948883056641
},
"Confidence": 90.114051818848
}
}
}
{
"Timestamp": 46520,
"Person": {
"Index": 11,
"BoundingBox": {
"Width": 0.19034090638161,
"Height": 0.42083331942558,
"Left": 0.30681818723679,
"Top": 0.17916665971279
},
"Face": {
"BoundingBox": {
"Width": 0.076486013829708,
"Height": 0.11217948794365,
"Left": 0.38680067658424,
"Top": 0.26923078298569
},
"Landmarks": [
{
"Type": "eyeLeft",
"X": 0.40642243623734,
"Y": 0.32347011566162
},
{
"Type": "eyeRight",
"X": 0.43237379193306,
"Y": 0.32369664311409
},
{
"Type": "nose",
"X": 0.42121160030365,
"Y": 0.34618207812309
},
{
"Type": "mouthLeft",
"X": 0.41044121980667,
"Y": 0.36520344018936
},
{
"Type": "mouthRight",
"X": 0.43202903866768,
"Y": 0.36483728885651
}
],
"Pose": {
"Roll": 0.3165397644043,
"Yaw": 2.038902759552,
"Pitch": -1.9931464195251
},
"Quality": {
"Brightness": 54.697460174561,
"Sharpness": 53.806159973145
},
"Confidence": 95.216400146484
}
}
}
In fact, in this video, all faces have the same index number, regardless of they are different. Any suggestions?
PersonDetail object is the result of the API . "index" is the identifier for the person detected in the video. So the index doesn't span across videos. It is just an internal reference.
Link below which details Index
https://docs.aws.amazon.com/rekognition/latest/dg/API_PersonDetail.html