AWS Lambda Function for CloudWatch Metric of Cognito User Pool POST to Mackerel.
-
Terraform v1.0.7〜
- terraform-provider-aws v3.59.0〜
-
AWS CLI v2 2.2.37 〜
-
Python 3.9
-
lambroll installed v0.11.8〜
- [macOS]
brew install lambroll
- [macOS]
-
AWS IAM User
- Access Keys of
AdministratorAccess
User aws configure --profile XXXXX
done
- Access Keys of
- uses terraform-aws-modules/terraform-aws-lambda v2.17.0〜
cd create
(vi terraform.tfvars # example below:)
terraform init
terraform plan
terraform apply
(terraform.tfvars example)
aws_access_key = "${ADMINISTRATOR_ACCESS_USER_ACCESS_KEY}"
aws_secret_key = "${ADMINISTRATOR_ACCESS_USER_SECRET_KEY}"
region = "ap-northeast-1"
profile = "XXXXXXX"
environment = "development"
service_name = "my-service"
cd lambroll
(vi .envrc # example below:)
direnv allow
(edit function.json : if necessary)
make dry-deploy
make deploy
(.envrc example)
export AWS_ACCESS_KEY_ID="${ADMINISTRATOR_ACCESS_USER_ACCESS_KEY}"
export AWS_SECRET_ACCESS_KEY="${ADMINISTRATOR_ACCESS_USER_SECRET_KEY}"
export AWS_DEFAULT_REGION="ap-northeast-1"
export AWS_PROFILE="XXXXXXX"
export FUNCTION_INVOKE_ROLE="arn:aws:iam::${AWS_ACCOUNT_ID}:role/lambdaCognitoMetricInvokerRole"