export ROLEARN="arn:aws:iam::<aws_account_number>:role/<role_name>"
export SESSION_NAME=mysession
ASSUME_ROLE=$(aws sts assume-role \
--role-arn "$ROLEARN" \
--role-session-name "$SESSION_NAME")
export AWS_ACCESS_KEY_ID=$(echo $ASSUME_ROLE | jq -r .Credentials.AccessKeyId)
{ | |
"Version": "2012-10-17", | |
"Statement": [ | |
{ | |
"Sid": "AWSLogDeliveryWrite", | |
"Effect": "Allow", | |
"Principal": { | |
"Service": "delivery.logs.amazonaws.com" | |
}, | |
"Action": [ |
#if you added new disk | |
for host in $(ls -1d /sys/class/scsi_host/*); do echo "- - -" > ${host}/scan ; done | |
#if you resized the existing disk | |
for device in $(ls -1d /sys/class/scsi_disk/*); do echo "1" > ${device}/device/rescan ; done |
Sample values.yml for argocd-helm chart to create users and grant permissions.
config:
# Argo CD's externally facing base URL (optional). Required when configuring SSO
accounts.qauser: apiKey, login
accounts.devuser: apiKey, login
accounts.adminuser: apiKey, login
.....
rbacConfig:
I use aws-vault with Yubikey to access AWS resources.
Lens is great Desktop tool to see/manage all k8s resources.
The following commands help me to open Lens The Kubernetes IDE the right EKS cluster on MacOS
# aws-vault exec -d 12h --prompt ykman my-profile --
# aws eks update-kubeconfig --name my-eks-cluster #switch to the right cluster
# /Applications/Lens.app/Contents/MacOS/Lens
This gist contains sample policy I used in my article at https://ismailyenigul.medium.com/how-to-setup-multi-aws-accounts-assume-role-with-aws-cli-45ae869661ed
For admin access from security to other accounts. save as admin-external-accounts.json
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "",
"Effect": "Allow",
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "",
"Effect": "Allow",
"Action": [
"logs:List*",
pipeline {
agent any
environment {
AWS_REGION = 'eu-west-1'
GITCOMMIT="${env.GIT_COMMIT}"
}
// options {
I used the following code block to add Tags into Cloudformation yaml file.
%{~ if length(mytags) >0 ~}
Tags:
%{~ endif ~}
%{~ for tag_key, tag_value in mytags ~}
- Key: "${tag_key}"
Value: "${tag_value}"
%{~ endfor ~}
Updated version of the groovy script at https://kublr.com/blog/advanced-jenkins-groovy-scripting-for-live-fetching-of-docker-images/ to use describe-images to sort AWS ECR images by date.
Don't forget to update MYREPO
with your repo name and aws region!
Assumption:
- Your Jenkins instance has right IAM role to access AWS ECR.
- Installed Active Choice Parameter or Extended Choice Parameter Plug-In
- Installed awscli on Jenkins instance