AMAZON ECS(4)ECS Configuration

AMAZON ECS(4)ECS Configuration

1 Improvement on Build the Docker Image

Configuration my S3 credentials
Create the credentials
> aws iam create-access-key --user-name carl

> mkdir ~/.aws

> vi ~/.aws/credentials

[default]
aws_access_key_id = AKIAIMP55MN4xxxxxxxx
aws_secret_access_key = BIr5Xlu1jvaFyfKT5DIxxxxxxxxx

After changes for this, we can have s3 command to do some work for us, for example
Copy the S3 file to Our Local in Makefile
app-model:
aws s3 cp s3://xxxx-xxxx/classifier_models.tar.gz .


Build the Tarball file
app-build:
sbt universal:packageZipTarball


Support private Docker Registration
IMAGE=sillycat/xxxxx-play
TAG=1.0
NAME=xxxxx-play
REPOSITORY=registry.sillycat.com

tag-local:
docker tag $(IMAGE):$(TAG) $(REPOSITORY)/$(IMAGE):$(TAG)


push-local:
docker push $(REPOSITORY)/$(IMAGE):$(TAG)


Fix Permission Issue
FATA[0000] Get http:///var/run/docker.sock/v1.18/images/json: dial unix /var/run/docker.sock: permission denied. Are you trying to connect to a TLS-enabled daemon without TLS?

Solution:
> sudo usermod -a -G docker carl

Restart the Server, it will work.

Pass parameter when we run the image
run-stage:
sudo docker run -d -p 8003:8003 -e RUNNING_ENV=stage --name $(NAME) $(IMAGE):$(TAG)


Auto Unzip for these files on Dockerfile
ADD xxxxxx_models.tar.gz /share/
ADD target/universal/xxxxx-play-1.0.tgz /share/

2 Steps to Build the ECS

Create a ECS first, Add EC2 Instances there.

EC2 AWS= Search ECS and choose Amazon ECS-Optinmized Amazon

Go to EC Configuration —> Advanced —> Add these command there:
echo ECS_CLUSTER=fr-production >> /etc/ecs/ecs.config
mkdir -p /media/ephemeral0/docker
source /etc/sysconfig/docker && echo OPTIONS=\"$OPTIONS -g /media/ephemeral0/docker\" >> /etc/sysconfig/docker
service docker restart

This command will start the EC2 instances and ask it to join the ECS cluster. In the mean time, they will use the share driver to store all the docker images and data.

Check where this directory is amount to
>sudo -h /var/lib/docker/devicemapper/devicemapper/data

Create ECS

Create EC2

Create Task Define

Create LB

Later I will go and read the documents about AWS Gateway.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值