$ aws sts get-caller-identity --query Arn
"arn:aws:iam::123456789012:user/neilguan"
$ aws sts get-caller-identity --query Arn --output text
arn:aws:iam::123456789012:user/neilguan
$ aws sts get-caller-identity --query Account --output text
123456789012
$ aws sts get-caller-identity --query UserId --output text
AIXXXXXXXXXXXXXXXXXXXG
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#$1 put kms id. | |
#$2 put values. | |
aws kms encrypt --key-id "$1" --plaintext $2 --output text --query CiphertextBlob | |
#output echo "output" | base64 -d file.txt | |
#decrypt via kms . | |
# aws kms decrypt --ciphertext-blob fileb://file.txt --query Plaintext --output text | base64 -d |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#!/bin/bash | |
yum install docker -y | |
systemctl start docker | |
usermod -aG docker ec2-user | |
usermod -aG docker ssm-user | |
chmod +x /var/run/docker.sock | |
systemctl restart docker && systemctl enable docker | |
mkdir /home/ec2-user/jenkins-data | |
docker run --name jks --rm -d -u root -p 8080:8080 -p 50000:50000 -v /home/ec2-user/jenkins-data:/var/jenkins_home -v /var/run/docker.sock:/var/run/docker.sock -v /home/ec2-user:/home jenkinsci/blueocean |
const vpc = new ec2.Vpc(this, 'testvpc', { natGateways: 1, cidr: '10.0.0.0/16' });
const change = ['10.0.7.0/24', '10.0.8.0/24', '10.0.9.0/24'];
for (let index = 0; index < change.length; index++) {
((vpc.node.findChild(`PublicSubnet${index + 1}`) as ec2.IPublicSubnet)
.node.findChild('Subnet') as ec2.CfnSubnet)
.addPropertyOverride('CidrBlock', change[index]);
}
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
##Color | |
RED='\033[0;31m' | |
GREEN='\033[0;32m' | |
NC='\033[0m' | |
## ENV | |
DEFAULT_REGION=us-west-2 | |
ACCOUNT_ID=123456789012 | |
AWS_REGION=${2-$DEFAULT_REGION} |
kind.yaml
apiVersion: kind.x-k8s.io/v1alpha4
kind: Cluster
nodes:
- role: control-plane
extraPortMappings:
- containerPort: 30002
hostPort: 30002
- role: worker
source: https://techviewleo.com/how-to-install-mysql-8-on-amazon-linux-2/
wget https://dev.mysql.com/get/mysql57-community-release-el7-11.noarch.rpm
sudo yum localinstall mysql57-community-release-el7-11.noarch.rpm -y
sudo yum install mysql-community-server -y
{
"Records": [
{
"body": "{\"url\": \"https://apps.apple.com/tw/app/facebook/id284882215\",\"line\": {\"reply\": {\"replyToken\": \"mockvalue\"}}}"
}
]
}
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as lambda from '@aws-cdk/aws-lambda'; | |
import * as s3 from '@aws-cdk/aws-s3'; | |
import { App, Construct, Stack, StackProps, CfnOutput, RemovalPolicy } from '@aws-cdk/core'; | |
// get date function. | |
function getdate() { | |
var date = new Date(); | |
var mm = date.getMonth() + 1; // getMonth() is zero-based | |
var dd = date.getDate(); | |
return [date.getFullYear(), | |
(mm>9 ? '' : '0') + mm, |