quantum-fusion / springboot_swagger_example-master-cassandra

0 stars 0 forks source link

AWS ECS setup with Multifactor authentication with AWS CLI instructions #26

Open quantum-fusion opened 6 years ago

quantum-fusion commented 6 years ago

Installing the AWS CLI on MACOS: http://docs.aws.amazon.com/cli/latest/userguide/cli-install-macos.html#awscli-install-osx-path

Setting up with AWS ECS Service: http://docs.aws.amazon.com/AmazonECS/latest/developerguide/get-set-up-for-amazon-ecs.html#create-an-iam-user

Create repository in ECS container service. http://docs.aws.amazon.com/AmazonECR/latest/userguide/repository-create.html

Provide repository a name: joethecoder2

Problem was no basic auth credentials for AWS CLI: https://stackoverflow.com/questions/34689445/cant-push-image-to-amazon-ecr-fails-with-no-basic-auth-credentials https://forums.aws.amazon.com/thread.jspa?messageID=722197

I had to enable multi factor authentication in order to get the AWS CLI to work: http://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_mfa.html https://aws.amazon.com/premiumsupport/knowledge-center/authenticate-mfa-cli/

% aws configure

% aws ecr get-login --no-include-email --region us-east-2 get password and repository URL, and execute docker login command provided on standard out.

% docker login -u AWS -p https://734122228327.dkr.ecr.us-east-2.amazonaws.com

% aws ecr list-images --repository-name=joethecoder2 { "imageIds": [] }

% cd dockerbuild

% docker build -t joethecoder2 .

% docker tag joethecoder2:latest 734122228327.dkr.ecr.us-east-2.amazonaws.com/joethecoder2:latest

% docker push 734122228327.dkr.ecr.us-east-2.amazonaws.com/joethecoder2:latest

Next Step: Setup Task, and number of containers. Add port 8080 for host and container ports.

tasksetup