This section describes the layout of the v1
version of this project.
env
: Any environment-related override files.- There are a number of JSON files in this folder which are used to override parameters in the various CloudFormation templates (via CodePipeline CloudFormation stages). This is very useful for making specific changes to different environments.
- This folder could also contain other environment configuration files for the application itself.
iac
: Any infrastructure-as-code (IaC) templates.- Currently this only contains CloudFormation YAML templates.
- The templates are categorized by AWS service to try to make finding and updated infrastructure easy.
- This folder could also contain templates for other IaC solutions.
node_modules
: Node.js modules that the Lambda(s) need to function. This folder will only exist if there are modules that the Lambda function needs.src
: The source files needed for the function (sans thenode_modules
folder).- You could house the source code for multiple related functions in this folder if this project has multiple functions to deploy.
version root
: All of the files that are generally designed to be at the base of the project.- Node.js
package.json
,package-lock.json
and CodePipelineversion.json
file. - Miscellaneous files, such as the version
README.md
file.
- Node.js
NOTE
These setup instructions assume you have already set up the base infrastructure: boilerplate-aws-account-setup
The boilerplate-aws-account-setup
repository will get cloned (uisng the "Use this template" button) for each set of accounts; this allows for base infrastructure changes that are specific to that account. Then changes can be made without impacting the original boilerplate repository.
- This repository is meant to be used as a starting template, so please make use of the "Use this template" button in the GitHub console to create your own copy of this repository.
- Since you have the base infrastructure in place, in your primary region, there should be an SSM parameter named:
/account/main/github/service/username
- This should be the name of the GitHub service account that was created for use with your AWS account.
- You will want to add this service account user to your new repository (since the repository is likely private, this is required).
- During the initial setup, the GitHub service account will need to be given admin. access so that it can create the needed webhook (no other access level can create webhooks at this time).
- You will want to make a local checkout of the repository that you created.
- Once you have the local checkout, switch to the
v1
folder. - Find the following CloudFormation template:
iac/cfn/codepipeline/deploy.yaml
- Log into the AWS Console for your account in your primary region.
- Go to the CloudFormation console.
- Upload this template and then fill in all of the needed parameter values.
- Go through all the other CloudFormation screens and then launch the stack.
- Monitor the stack and make sure that it completes successfully.
The version of the application can only be managed manually for this simple flow.
NOTE
Semantic versioning should be used for maintaining the version of this application. If the same versioning method is used between applications, it is helpful for consistency.
Given a version number MAJOR.MINOR.PATCH
, increment the:
MAJOR
version when you make incompatible API changes,MINOR
version when you add functionality in a backwards compatible manner, andPATCH
version when you make backwards compatible bug fixes.- Additional labels for pre-release and build metadata are available as extensions to the
MAJOR.MINOR.PATCH
format.
Since this is a Node.js application, the package.json
file manages the version number for the application. However, AWS CodePipeline can only read from a flat JSON file. Because of this, there is a simple version.json
file, which can be used to manage the version of the repository.
- Once you have your changes ready to commit to your
bugfix
/feature
branch, review the changes and see which semantic versioning level they match up with. - Open the
package.json
file. - Update the the
version
property in the JSON object to the needed value. - Open the
version.json
file. - Update the the
version
property in the JSON object to the needed value. - Commit these version updates with the rest of your changes.
- Merge your pull request into the
main
branch. - The AWS CodePipeline will notice that you manually updated the version number and will use your version number.