This is a part in a series on AWS serverless architecture. The original blog post series can be found both here and on my blog J-bytes.
Managing Installs
What you need to install and setup to get this project to work.
- Install Ruby, Node.js, npm on your local machine.
- Initialize whatever version of version control you like (jk, install Git)
- Install Postman and the AWS CLI tools (google these, very straightforward). You need the tools to manage our API later.
- If you actually want to send emails at some point, you will need to set up either a Sendgrid account or a Mailgun account. I recommend Mailgun if you just need to test things because Sendgrid has a high chance to reject you if you aren't an established business. I was rejected based on IP, I believe (no love for Japan T_T). We will use Mailgun for this tutorial. You can swap out for Sendgrid as needed - it is very similar to Mailgun.
If you use Mailgun, you will also most likely need a domain linked to your Mailgun account. I didn't link a domain at first – it sent about 3 messages and then quit out on me. Linking depends on your hosting provider; use your google-fu when the time comes.
Version Control
We need to have a brief, but serious conversation about the unusual flow of version control in this project.
I am assuming that everything that we do, you will be backing up to version control. This means:
Each Lambda that we make should have its own folder in your VCS. There is a very specific reason for this: When you want to upload libraries to AWS Lambda (I'll explain that later if you don't understand), you will store the libraries and code in the same folder.
If you change a Lambda in the AWS Console Lambda in-browser code editor instead of changing it on your local system and uploading the changes, I assume that you copy-paste those changes into the appropriate index.js file in your VCS and save it, because we do not trust aws to manage your code for you.
Every time we deploy an API gateway to a stage, I assume that you go to stage -> export -> the middle option (swagger / yaml), and then put that YAML file in your VCS somewhere because we do not trust aws to manage your code for you.
I had a serious incident where API gateway has (four times!) deleted some settings that I very much needed after I deployed to a stage. When I contacted support, they said the error only happens if you make an error using the AWS CLI. I still don't know what I did wrong, and having exports made reconstruction much faster. It is terrible to lose work for no good reason.
I may mention that we should save something in version control every now and again, but overall I assume you can handle yourself.
Excellent. On with the show!
Top comments (0)