Skip to content
Snippets Groups Projects
Select Git revision
  • 223674-remove-updated-suggestions-from-batch
  • 222780-batch-suggestions-wrong-lines
  • 25486-batch-suggestions
  • batch-code-review
  • fix-batch
  • working-batch-suggestions
  • 198353-copying-video-audio
  • media_partial_paths
  • batch-suggestions-array
  • batch-suggestions-dictionary
  • master default protected
  • 34276-hash-on-url-when-create-mr
  • 33533-go-to-root-if-no-path-on-branch
  • 19822-audio-preview-in-repo
  • 33603-ruby-part-refactor-playable-link-filters
  • working-tests-go-to-root
  • 16654-audio-in-markdown
  • helpful-redirects
  • 18066-change-branch-on-file-history
  • no-404-blame-history-files
  • v12.0.9-ee
  • v12.1.9-ee
  • v12.2.5-ee
  • v12.2.4-ee
  • v12.0.8-ee
  • v12.1.8-ee
  • v12.2.3-ee
  • v12.2.1-ee
  • v12.2.0-ee
  • v12.2.0-rc32-ee
  • v12.2.0-rc31-ee
  • v12.1.6-ee
  • v12.0.6-ee
  • v11.11.8-ee
  • v12.1.4-ee
  • v12.1.3-ee
  • v11.11.7-ee
  • v12.1.2-ee
  • v12.0.4-ee
  • v12.1.1-ee
40 results

gitlab-ee

  • Clone with SSH
  • Clone with HTTPS
  • Forked from GitLab.org / GitLab
    Source project has a limited visibility.

    CloudFormation nested stack configuration with Cognito, ALB, EC2, Route53 for different environments

    My post on Medium about the project: https://medium.com/p/f58cd16628

    Pre-reqs

    Before you start, make sure the following requirements are met:

    • An AWS account with permissions to create resources, a DNS domain in Route53, and a SSL/TLS certificate in Certificate Manager.
    • AWS CLI installed on your local machine.

    Building & Running

    1. Create S3 bucket for nested stack templates
    aws s3api create-bucket --bucket bucket-name --region YOUR_REGION --create-bucket-configuration LocationConstraint=YOUR_REGION
    1. Send all nested stack files to the S3 bucket
    aws s3 cp . s3://bucket-name --recursive --exclude ".git/*" --exclude README.md --exclude user_data.txt --exclude ".images/*"
    1. Create ssh key and convert it into RSA format (if you don't have it)

    generation ssh key converting ssh key into RSA forma

    ssh-keygen -t rsa -b 2048 -f ~/.ssh/ws-ec2-keypair
    ssh-keygen -p -m PEM -f ~/.ssh/ws-ec2-keypair
    1. Fill all necessary parameters and create CloudFormation stack

    take AMI:

    aws ec2 describe-images --filters "Name=name,Values=Windows_Server-2022-English-Full-Base-*" "Name=architecture,Values=x86_64" "Name=root-device-type,Values=ebs" "Name=virtualization-type,Values=hvm" --query "Images | sort_by(@, &CreationDate) | [-1]" --output json

    create stack:

    aws cloudformation create-stack \
        --stack-name cognito-alb-ec2 \
        --template-body file://root.yaml \
        --capabilities CAPABILITY_NAMED_IAM \
        --parameters ParameterKey=UserData,ParameterValue="$(base64 -i user_data.txt)" \
        ParameterKey=PublicKeyMaterial,ParameterValue="$(cat ~/.ssh/ws-ec2-keypair.pub)" \
        --capabilities CAPABILITY_NAMED_IAM \
        --disable-rollback

    take the ec2 instance password:

    aws ec2 get-password-data --instance-id  i-1234567890abcdef0 --priv-launch-key C:\Keys\ws-ec2.pem
    1. Delete the CloudFormation stack
    aws cloudformation delete-stack --stack-name cognito-alb-ec2
    1. Delete all files from the S3 bucket
    aws s3 rm s3://bucket-name--recursive
    1. delete the S3 bucket
    aws s3 rb s3://bucket-name --force 

    AWS Infrastructure shcema

    schema