aws-samples / aws-iot-twinmaker-samples

Apache License 2.0
97 stars 77 forks source link

Cloud9: Browsing your Grafana instance without exposing the instance to HTTP in security groups #18

Open doronbl opened 2 years ago

doronbl commented 2 years ago

When working in Cloud9 environment, there is a simple option to expose the grafana container instantiated as part of the setup_local_grafana_docker.sh to the end user without to

temporarily changing the Ingress rule for HTTP in your security group to "Anywhere-IPv4"

This can be achived by leveraging Cloud9 integrated port forwarding. See here for more details: https://docs.aws.amazon.com/cloud9/latest/user-guide/app-preview.html#app-preview-preview-app

Simple modification of the way grafana container is instantiated to use port 8080 instead of 80:

docker run -d \
  -p 8080:3000 \
  --name=${CONTAINER_NAME} \
  -v ${SCRIPT_DIR}/local_grafana_data:/var/lib/grafana \
  -e "GF_INSTALL_PLUGINS=grafana-iot-twinmaker-app" \
  grafana/grafana:8.2.5

Will enable the user to brows from his local PC to Cloud9 address (securly over HTTPS):

https://<cloud9-environment-id>.vfs.cloud9.<region>.amazonaws.com/