aws-toolkit-eclipse
aws-toolkit-eclipse copied to clipboard
Unable to deploy serverless project
My serverless.template file is as follows. while trying to launch I get error "Failed to deploy serverless project to AWS CloudFormation. Failed to create CloudFormation change set: [/Description] 'null' values are not allowed in templates"
{ "Type": "AWS::Serverless::Function", "Properties": { "Handler": "lambda.LambdaFormFunctionHandler", "Runtime": "Java", "CodeUri": "s3://lambda-function-bucket-us-east-1-1551523177857/LambdaForm-0.1-SNAPSHOT-shaded.jar", "Policies": [ "AmazonDynamoDBReadOnlyAccess", "AmazonS3ReadOnlyAccess" ]
},
"Resources" : {
"myDynamoDBTable" : {
"Type" : "AWS::DynamoDB::Table",
"Properties" : {
"AttributeDefinitions": [ {
"AttributeName" : {"Ref" : "HashKeyElementName"},
"AttributeType" : {"Ref" : "HashKeyElementType"}
} ],
"KeySchema": [
{ "AttributeName": {"Ref" : "HashKeyElementName"}, "KeyType": "HASH" }
],
"ProvisionedThroughput" : {
"ReadCapacityUnits" : {"Ref" : "ReadCapacityUnits"},
"WriteCapacityUnits" : {"Ref" : "WriteCapacityUnits"}
}
}
}
},
"Outputs" : {
"InfrastructureIP" : {
"Description": "The private IP of Infrastructure",
"Value" : { "Fn::GetAtt" : [ "Infrastructure", "PrivateIp" ] }
}
}
}
It seems this template is not in the right format. The AWS::Serverless::Function resource type should be included in the Resource bracket.
Thank you for addressing. I changed to the following still getting error.
{
"Resources" : {
"MyFunction" : {
"Type" : "AWS::Serverless::Function",
"Properties" : "LambdaFormFunctionHandler",
"CodeUri" : "..//target//LambdaForm.jar"
},
"Type": "AWS::Serverless::Function",
"Properties": {
"Handler": "lambda.LambdaFormFunctionHandler",
"Runtime": "Java",
"CodeUri": "..//target//LambdaForm.jar",
"Policies": [
"AmazonDynamoDBReadOnlyAccess",
"AmazonS3ReadOnlyAccess"
]},
"myDynamoDBTable" : {
"Type" : "AWS::DynamoDB::Table",
"Properties" : {
"AttributeDefinitions": [ {
"AttributeName" : {"Ref" : "HashKeyElementName"},
"AttributeType" : {"Ref" : "HashKeyElementType"}
} ],
"KeySchema": [
{ "AttributeName": {"Ref" : "HashKeyElementName"}, "KeyType": "HASH" }
]
},
"ProvisionedThroughput" : {
"ReadCapacityUnits" : {"Ref" : "ReadCapacityUnits"},
"WriteCapacityUnits" : {"Ref" : "WriteCapacityUnits"}
}
}
},
"Outputs" : {
"InfrastructureIP" : {
"Description": "The private IP of Infrastructure",
"Value" : { "Fn::GetAtt" : [ "Infrastructure", "PrivateIp" ] }
}
}
}
Can you please guide to set it right.
I've formatted the JSON code here, and it still is not a valid CloudFormation template. Also, the output Infrastructure doesn't exist. Not sure if you emit that on purpose or it was not there in the first place.
{
"Resources": {
"MyFunction": {
"Type": "AWS::Serverless::Function",
"Properties": "LambdaFormFunctionHandler",
"CodeUri": "..//target//LambdaForm.jar"
},
"Type": "AWS::Serverless::Function",
"Properties": {
"Handler": "lambda.LambdaFormFunctionHandler",
"Runtime": "Java",
"CodeUri": "..//target//LambdaForm.jar",
"Policies": [
"AmazonDynamoDBReadOnlyAccess",
"AmazonS3ReadOnlyAccess"
]
},
"myDynamoDBTable": {
"Type": "AWS::DynamoDB::Table",
"Properties": {
"AttributeDefinitions": [
{
"AttributeName": {
"Ref": "HashKeyElementName"
},
"AttributeType": {
"Ref": "HashKeyElementType"
}
}
],
"KeySchema": [
{
"AttributeName": {
"Ref": "HashKeyElementName"
},
"KeyType": "HASH"
}
]
},
"ProvisionedThroughput": {
"ReadCapacityUnits": {
"Ref": "ReadCapacityUnits"
},
"WriteCapacityUnits": {
"Ref": "WriteCapacityUnits"
}
}
}
},
"Outputs": {
"InfrastructureIP": {
"Description": "The private IP of Infrastructure",
"Value": {
"Fn::GetAtt": [
"Infrastructure",
"PrivateIp"
]
}
}
}
}
Could you please point out the error or give a sample template to set it right.
เมื่อ อา. 17 มี.ค. 2562 เวลา 13:56 surathmu [email protected] เขียนว่า:
Could you please point out the error or give a sample template to set it right.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/aws/aws-toolkit-eclipse/issues/135#issuecomment-473622281, or mute the thread https://github.com/notifications/unsubscribe-auth/Ao3HF3RIwglYITZGudhzyE3a48APvl4_ks5vXeb_gaJpZM4bmiR7 .