Please note the Pre-requisites on the landing page before continuing forward!
Please export the following variables before running the steps below:
SAM_DEPLOYMENT_BUCKET
= this is an existing AWS S3 bucket in the same region for SAM artifacts to be staged inNEW_LOG_BUCKET_NAME
= the name of the new AWS S3 Bucket to create for logging and auditingNEW_STATIC_SITE_BUCKET_NAME
= the name of the new AWS S3 Bucket to store all static content to be served up by the Amazon CloudFront DistributionSECRETS_MANAGER_KEY_ARN
= the ARN of the AWS Secrets Manager Key created for storing relevant OIDC Application Information. This is the Secrets Manager Secret ARN copied from the prior step.
**NOTE: Replace the corresponding
Mac/Linux/Unix:
export SAM_DEPLOYMENT_BUCKET=my-bucket-name
export NEW_LOG_BUCKET_NAME=my-new-logging-bucket
export NEW_STATIC_SITE_BUCKET_NAME=my-new-static-content-bucket
export SECRETS_MANAGER_KEY_ARN=arn:aws:secretsmanager:us-east-1:012345678910:secret:secretName
Windows:
set SAM_DEPLOYMENT_BUCKET=my-bucket-name
set NEW_LOG_BUCKET_NAME=my-new-logging-bucket
set NEW_STATIC_SITE_BUCKET_NAME=my-new-static-content-bucket
set SECRETS_MANAGER_KEY_ARN=arn:aws:secretsmanager:us-east-1:012345678910:secret:secretName
a. Build lambda function, and prepare them for subsequent steps in the workflow
sam build -b ./build -s . -t template.yaml -u
b. Packages the above LambdaFunction. It creates a ZIP file of the code and dependencies, and uploads it to Amazon S3 (please create the S3 bucket and mention the bucket name in the command below). It then returns a copy of AWS SAM template, replacing references to local artifacts with the Amazon S3 location where the command uploaded the artifacts
sam package \
--template-file build/template.yaml \
--s3-bucket ${SAM_DEPLOYMENT_BUCKET} \
--output-template-file build/packaged.yaml
c. Deploy Lambda functions through AWS CloudFormation from the S3 bucket created above. AWS SAM CLI now creates and manages this Amazon S3 bucket for you.
sam deploy \
--template-file build/packaged.yaml \
--stack-name oidc-auth \
--capabilities CAPABILITY_NAMED_IAM \
--parameter-overrides BucketName=${NEW_STATIC_SITE_BUCKET_NAME} LogBucketName=${NEW_LOG_BUCKET_NAME} SecretKeyArn=${SECRETS_MANAGER_KEY_ARN}
Navigate to Set up Registered OIDC Application for the next step.