https://awscli.amazonaws.com/v2/documentation/api/latest/index.html
https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html
cd /tmp && mkdir awscli && cd awscli
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
unzip awscliv2.zip
sudo ./aws/install
sudo ./aws/install --update
aws --version
AWS CLI Session Manager plugin
To be able to aws ecs execute-command to an ECS container (eg: Fargate).
curl -o "session-manager-plugin.deb" "https://s3.amazonaws.com/session-manager-downloads/plugin/latest/ubuntu_64bit/session-manager-plugin.deb"
sudo dpkg -i session-manager-plugin.deb
(for uninstalling) sudo dpkg -r session-manager-plugin
Verify installation
session-manager-plugin
~/.aws/config
[default]
region = eu-west-1
output = json
[profile myp1]
region = eu-west-1
output = json
~/.aws/credentials
[default]
aws_access_key_id = AKIAWKIV2VD2NS65NS27
aws_secret_access_key = TIyktEGLyvzNRcgBGpb5mOpLFUXo6goe70t9nl27
[myp1]
aws_access_key_id = AKIAXKMPJSDELFEYRT8L
aws_secret_access_key = ktvhg42zN8qnBaGF/Ops4A28LFtoJ7mmJGBHwqTI
Sample:
aws ecr get-login-password --region eu-west-1 | docker login --username AWS --password-stdin 274374682878.dkr.ecr.eu-west-1.amazonaws.com
Sample:
aws ecs update-service --cluster ecs-cluster-myapp-test --service myapp_back-service-test --task-definition myapp_back-test --force-new-deployment > /dev/null
Sample:
# CONFIG
tech_comp=myapp_calendar
lambda_name=calendar-myapp-dev
#
aws lambda update-function-code \
--function-name $lambda_name \
--zip-file fileb://$tech_comp.zip > /dev/null
aws s3 rm s3://$(s3_bucket_name)/$(dir_name) --recursive
aws s3 cp ./dist s3://$(s3_bucket_name) --recursive
Note: If needed, flag: --acl public-read
aws cloudfront create-invalidation --distribution-id $(cf_dist) --paths \
"/$(tech_comp)/en/index.html" \
"/$(tech_comp)/es/index.html" \
"/$(tech_comp)/pl/index.html" \
> /dev/null
aws ssm put-parameter \
--name parameter-name \
--value "parameter-value" \
--type "String" \
--description "Only read, not created nor modified, by the Serverless framework" \
--tags '[{"Key":"env","Value":"PRE"},{"Key":"ci", "Value":"sixqueue"}]'
Note: --profile allows to provide the 'config' and 'credentials' profile to be used
aws ssm get-parameters-by-path --profile myp1 --path /dev/myapp