In this section, you will update source code in Eclipse, overwriting Hello World! microservice sample and replace it with the code of FlightService. Then, you will commit the code changes to CodeCommit to enable deployment to your AWS Lambda environment and update the Amazon API Gateway configuration to match.
cd git\dev-flight-svc
git checkout -b "new-implementation"
If you do not delete the contents of the /src and /target directories before copying the new code, the build process will fail because we do not configure HelloWorldController / Handler.
Once done, you will see the following directory structure:
{
"Version": "2012-10-17",
"Statement": [
{
"Action": [
"iam:GetRole",
"iam:CreateRole",
"iam:DeleteRole",
"iam:PassRole",
"iam:PutRolePolicy",
"iam:DeleteRolePolicy",
"lambda:ListTags",
"lambda:TagResource",
"lambda:UntagResource",
"lambda:AddPermission",
"ec2:DescribeSecurityGroups",
"ec2:DescribeSubnets",
"ec2:DescribeVpcs",
"ec2:CreateNetworkInterface",
"ec2:AttachNetworkInterface",
"ec2:DescribeNetworkInterfaces"
],
"Resource": "*",
"Effect": "Allow"
}
]
}
idevelopCodeStarCloudFormationPolicy
for policy name and click Create policy.When adding the CodeStarWorker-dev-flight-svc-CloudFormation role, the permissions in the idevelopCodeStarCloudFormationPolicy policy allow CLoudFormation to act on your behalf when implementations change in the environment, including permission permissions Lambda function attached to the VPC where the RDS instance hosting the TravelBuddy website is deployed. They also allow CloudFormation to create a new IAM Role that the Lambda function uses to execute.
The CloudFormation template template.yml file provided in FlightSpecials.zip has several values that need updating before proceeding with deployment. These values include Subnet Ids, Security Group Ids and the RDS Instance Endpoint.
Open template.yml file and replace sg- value with Security Group Id of DBSecurityGroup.