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
# List all security Groups with GroupName SSH | |
aws --profile sandbox ec2 describe-security-groups --query SecurityGroups[?GroupName=='SSH'] | |
# Launch Instance | |
aws --profile sandbox ec2 run-instances --image-id ami-48c62427 --key-name sandbox --security-group-ids sg-XXXXXXXX --instance-type t2.small --subnet-id subnet-XXXXXXX | |
# Describe Public IP of running instances | |
aws --profile sandbox ec2 describe-instances --query Reservations[*].Instances[?State.Name=='running'].{PublicIp:PublicIpAddress} | |
# Authorize Ingress Security Group for SSH to ALL |
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
AWSKMSClient awskmsClient = new AWSKMSClient(); | |
awskmsClient.setRegion(Region.getRegion(Regions.EU_CENTRAL_1)); | |
String token = "Dummy"; | |
ByteBuffer plainText = ByteBuffer.wrap(token.getBytes()); | |
EncryptRequest encryptRequest = new EncryptRequest().withKeyId(keyId).withPlaintext(plainText); | |
EncryptResult encryptResult = awskmsClient.encrypt(encryptRequest); | |
String kmsEncryptedToken = Base64.getEncoder().encodeToString(encryptResult.getCiphertextBlob().array()); | |
System.out.println(kmsEncryptedToken); |
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
# Add these lines | |
batch | |
passphrase-file <Full path to the key.txt file (without tilda)> |