DEV Community

Jim Bledsoe
Jim Bledsoe

Posted on

Completing Forrest Brazeal's Resume Challenge - Part 2

Now that the website is up and running via Cloudfront, it's time to look at some loose ends and start on the Web API portion.

More Terraform for Namecheap.com

One of the things that bugged me was that I set up the subdomain resume.jimbledsoe.me on both the AWS and Namecheap side by hand. I found out after-the-fact that Namecheap had a Terraform provider.

I dug into it a little bit further and found out that they have requirements to get an API key that I probably won't meet. One requirement is to have 50 domains with them - I don't have that. Another is to spend $50/yr with them or have a $50 balance in your account, and I don't have that, either.

So it looks like automating the subdomain configuration will remain as a hand-made step. I will likely change the subdomain later to aws.jimbledsoe.me to be more flexible for future projects and also make it more logical once I start registering subdomains for other cloud providers. But I will not worry over this just yet.

Configuring a Simple Web API with Serverless Application Model (SAM)

I decided to work from the bottom-up on the visitor counter and Web API so there is less rework. I will deploy just a sample SAM application from the AWS catalog as-is, and then keep expanding on it, since there are five or six issues related to building it up.

The order I will likely be working on the Web API are as follows:

  1. Implement Lambda as a SAM CloudFormation
  2. Store Visitor Counter in DynamoDB
  3. Visitor Counter should implement Lambda API to interact with DynamoDB
  4. Include unit tests for Python Lambda
  5. CI/CD for Lambda Web API
  6. Resume page includes a visitor counter

I may move the unit tests up the priority stack, but until I actually get the Lambda doing something significant, there' not much to test. I will just be hard coding the API to return 1 as the count until it gets to the DynamoDB parts.

The CI/CD I may move up earlier, too. The only reason I have it so low on the list is because it needs to deploy only if all the unit/integration tests pass. There's plenty of chicken-and-egg to it at this point.

I have broken down the issues as they are now, just to line up with the numbered requirements (1-14) posted in the challenge. I probably would have broken them down a little differently if I was building this up myself. But that's also part of the fun of this - flex to what you are given for requirements and built it up from tiny pieces one-by-one.

Conclusion

The SAM implementation was easy since I am only publishing a hello-world template as of now. There was a template for a DynamoDB backed API as a template, but they did not have a Python version, so it ended up just being a hello world Lambda. Adding DynamoDB should be easy.

The IAM permissions were much easier for this, too, since the SAM documentation said just add these six-or-so policies, which were ones like AWSLambda_FullAccess and other "full-access" policies. I may end up reworking the IAM later based on "full-access" for the resources Terraform is working with.

Latest comments (0)