I would like make use of AWS CLI to create a listener for my application load balancer.
aws elbv2 create-listener \
--load-balancer-arn $ALB_ARN \
--protocol HTTPS \
--port 443 \
--default-actions "Type=forward,TargetGroupArn=$TG_ARN" \
--certificates CertificateArn=$CERT_ARN
I was able to create a listener on port 443 to forward to the target group. The shell variables represent the arn for the application load balancer (ALB), target group (TG) and certificate (CERT).
How can I add to this command Cognito authentication for an existing user pool? (It is either fine to modify the existing listener or to create a new one, however I need to do this via AWS CLI).
Thank you very much!
You will need to first create a
JSONfile with the actions mentioned. Below is an example taken from link:In this, you will need to fill the lines
UserPoolArn,UserPoolClientId,UserPoolDomain,TargetGroupArnand optinallySessionCookieNameto meet your deployment. Once all is filled, below CLI will create a new HTTPS listener with Auth config:config.jsonis the file with the settings