Amazon
EC2
Docker
How to Install Docker on Ubuntu 22.04
sudo apt update
sudo apt upgrade
sudo apt install apt-transport-https ca-certificates curl software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt update
sudo apt-cache policy docker-ce
sudo apt install docker-ce
sudo systemctl status docker
sudo usermod -aG docker ubuntu
AWS CLI
Installing or updating the latest version of the AWS CLI
sudo apt install unzip
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
unzip awscliv2.zip
sudo ./aws/install
Config
Configuration and credential file settings
~/.aws/credentials
[default]
aws_access_key_id=AKIAIOSFODNN7EXAMPLE
aws_secret_access_key=wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
~/.aws/config
[default]
region=ca-central-1
output=json
Misc Commands
aws s3 ls
Running a Docker Image on EC2
https://docs.aws.amazon.com/AmazonECS/latest/developerguide/create-container-image.html
Amazon Elastic Transcoder
Using Amazon Elastic Transcoder is more expansive than running our own lambda service. Amazon Elastic Transcoder Transcoding audio with AWS Lambda SoX - Sound eXchange | HomePage An audio conversion use case: comparison of execution speed between SoX, FFmpeg and MPlayer
Lambda
- Tutorial – Publishing a custom runtime: In this tutorial, you create a Lambda function with a custom runtime. You start by including the runtime in the function's deployment package. Then you migrate it to a layer that you manage independently from the function. Finally, you share the runtime layer with the world by updating its resource-based permissions policy.
ECR
Creating a container image for use on Amazon ECS
aws ecr create-repository --repository-name common-voice --region ca-central-1
{
"repository": {
"repositoryArn": "arn:aws:ecr:ca-central-1:194183794986:repository/common-voice",
"registryId": "194183794986",
"repositoryName": "common-voice",
"repositoryUri": "194183794986.dkr.ecr.ca-central-1.amazonaws.com/common-voice",
"createdAt": "2022-05-24T16:40:41-04:00",
"imageTagMutability": "MUTABLE",
"imageScanningConfiguration": {
"scanOnPush": false
},
"encryptionConfiguration": {
"encryptionType": "AES256"
}
}
}
aws ecr get-login-password \
| docker login --username AWS --password-stdin 194183794986.dkr.ecr.ca-central-1.amazonaws.com/common-voice
docker tag common-voice_web:latest 194183794986.dkr.ecr.ca-central-1.amazonaws.com/common-voice
docker push 194183794986.dkr.ecr.ca-central-1.amazonaws.com/common-voice
Deploy applications on Amazon ECS using Docker Compose Deploying Docker containers on ECS Docker compose CLI Install
#docker context create ecs
#PATH=.:$PATH ./docker-linux-amd64 context create ecs common-voice
PATH=.:$PATH ./docker-linux-amd64 context create ecs ecs.common-voice
#PATH=.:$PATH ./docker-linux-amd64 context use common-voice
PATH=.:$PATH ./docker-linux-amd64 --context ecs.common-voice compose up