Setup AWS CLI for Persgroep account
1 Download Masl
https://github.com/glnds/masl/releases and download the newest release for your operating system and store it somewhere where you're path have access. ~/bin
is usually added to the path, if not, make it so.
2 Configure Masl
Create a file: ~/.masl/config.toml
and alter it with your'e own credentials.
See the unfilered version in LastPass, just replace wit you're email address.
Search in lastpass for: Masl config
BaseURL = 'https://api.eu.onelogin.com/'
ClientID = 'XXXX'
ClientSecret = 'XXXX'
AppID = 'XXXX'
Subdomain = 'persgroep'
Username = 'rick.sanchez@persgroep.net'
Duration = 43200
Profile = 'persgroep'
[[Accounts]]
ID = 'XXXX'
Name = 'persgroep'
3 Run, and enjoy
➜ masl dpg
OneLogin Password:
w00t w00t masl for you!
Assumed User: arn:aws:sts::952653322924:assumed-role/DP-1L-Admin/rene.weteling@dpgmedia.nl
In account: 952653322924 [persgroep]
Token will expire on: 2021-07-13 01:06:56 +0000 UTC
Using AWS Profile(s): 'persgroep' & 'persgroep'
Handy AWS shortcuts
Installation
Shorcuts below should be added to youre profile.
# Tell AWS to use the persgroep profile, wich is set by MASL
export AWS_PROFILE="persgroep"
# Sync the s3 from production to acceptance
alias dpg_sync_s3_games="aws --profile persgroep s3 sync s3://production-mc-games-static-games s3://test-mc-games-static-games"
# Log in into the docker ECR of AWS
alias dpg_docker_login="aws ecr get-login-password --region eu-west-1 --profile persgroep | docker login --username AWS --password-stdin 952653322924.dkr.ecr.eu-west-1.amazonaws.com"
# Really handy to read out some parameters from the parameter store
function dpg_parameter() { aws ssm get-parameter --profile persgroep --with-decryption --name $@ --output json | jq '.Parameter.Value' }
Setup AWS CLI for Mychannels account (to sync image buckets)
- Install AWS CLI
- Run aws configure for a new profile (mychannels:
aws configure --profile mychannels
- Ask other devs for the aws_access_key_id and aws_secret_access_key / or create a new in IAM with the same permissions as the ECR+ECS admin user
- To sync the fun buckets:
aws s3 sync s3://mc-games-production s3://mc-games-preview --profile mychannels
- To sync the video buckets:
aws s3 sync s3://mc-uploads-production s3://mc-uploads-preview --profile mychannels
- Aliases:
alias aws.imgix.sync.all="aws.imgix.sync.fun && aws.imgix.sync.video"
alias aws.imgix.sync.fun="aws s3 sync s3://mc-games-production s3://mc-games-preview --profile mychannels"
alias aws.imgix.sync.video="aws s3 sync s3://mc-uploads-production s3://mc-uploads-preview --profile mychannels"