A HTTP GET API that returns the current timestamp in a ISO8601 string, and also the region the server is running is as a JSON payload.
curl https://API_ID.execute-api.ap-southeast-2.amazonaws.com/timeDeveloped using AWS CDK in TypeScript, a complete development kit tools for AWS environment, to define the cloud infrastructure in code and provisioning it through AWS CloudFormation.
The AWS CDK puts the infrastructure, application code, and configuration all in one place and together with TypeScript can avoid incorrect assumptions about runtime behavior, or other errors.
The AWS CloudFormation is one of the requirements, and because of it I decided not to go with third-party tools (Pulumi or Terraform) to define the cloud infrastructre as code. Otherwise, I would have choosen tools that use AWS API to provising the code, as they can be faster with less requiremnts.
- AWS CLI - To configure the AWS Credetials.
- AWS CDK - To run the local commands and deploy the application.
- Docker - To run the local commands and deploy the application.
- nmv - to set up Node.js v16
aws configureconfigure AWS CLI optionsyarn installinstall package.json dependenciesyarn buildcompile typescript to jsyarn watchwatch for changes and compileyarn testperform the jest unit testsyarn formatrun a code formatter for entire applicationyarn cdk bootstrapprovisions a CloudFormation stack called CDKToolkit (Required to deploy)yarn cdk deploydeploy this stack to your default AWS account/regionyarn cdk diffcompare deployed stack with current stateyarn cdk synthemits the synthesized CloudFormation template
This application is serverless microservice, it is a cloud-based service that uses serverless functions to perform highly specific roles, executes small segments of code in response to events, are modular and easily scalable, making them well-suited for microservice-based architectures. Also, it can be easily integrated with a range of managed services, which minimizes the overhead that is often associated with other microservice implementations.
