The IaC for the deployment of IaC is in AWS CDK.
The React application is deployed using AWS CloudFront and S3, utilizing a custom subdomain prefixed with orcaui
and appended with the respective domain name within their AWS account. Deployment is managed within the toolchain (build) account, enabling the stack to be deployed across multiple accounts.
For each account, the React assets are built and then pushed to a designated S3 bucket using AWS CodeBuild and Lambda functions. Specifically, a Lambda function uploads the assets to S3 and subsequently triggers CodeBuild. CodeBuild then compiles the React application and uploads the built assets back to S3.
The deployment strategy is to deploy the React application to the toolchain account, and then use AWS CodePipeline to deploy the application to the respective accounts.
The env config lambda is used to update the env.js file in the S3 bucket. Env Config Lmabda here
Normally, the lambda function is invoked by the CodeBuild project. This is done by adding a code build action in the CodeBuild project to invoke the lambda function.
If you want to invoke the lambda function manually, you can use the following command (without payload):
aws lambda invoke \
--function-name CodeBuildEnvConfigLambdaBeta \
response.json
if you wanna invoke manually with payload to update the api version, you can use the following command:
aws lambda invoke \
--function-name CodeBuildEnvConfigLambdaBeta \
--payload '{"metadata_api_version": "v2"}' \
response.json
Update multiple API versions
aws lambda invoke \
--function-name CodeBuildEnvConfigLambdaBeta \
--payload '{
"metadata_api_version": "v2",
"workflow_api_version": "v2",
"sequence_run_api_version": "v1",
"file_api_version": "v2"
}' \
response.json
invoke with a specific AWS profile:
aws lambda invoke \
--profile your-profile-name \
--function-name CodeBuildEnvConfigLambdaBeta \
--payload '{"metadata_api_version": "v2"}' \
response.json
Change to the deploy directory
cd deploy
Install the dependencies
yarn install
To deploy the cdk
yarn cdk deploy
To test cdk resources in compliance with cdk-nag
yarn test