9 - AWS (Light Theme)
9 - AWS (Light Theme)
9 - AWS (Light Theme)
AWS Services
Demo Projects
❏ Watched video
Useful Links:
Useful Links:
● Step by Step instruction on how to create and activate a new Amazon Web
Services account?
https://aws.amazon.com/premiumsupport/knowledge-center/create-and-activat
e-aws-account/
● Services included in Free Tier:
https://aws.amazon.com/free/?all-free-tier&all-free-tier.sort-by=item.additional
Fields.SortRank&all-free-tier.sort-order=asc
❏ Watched video
❏ Demo executed - Created Admin IAM User
Best Practice:
● Assign the permission (policy) to the Role, rather than on the User directly
● Give User the least privilege they need
Useful Links:
Useful Links:
● IP Calculator: http://jodies.de/ipcalc?host=10.0.0.0&mask1=1&mask2=
● Calculate sub-cidr blocks: http://www.davidc.net/sites/default/subnets/subnets.html
Check your progress... 3/9
Useful Links:
Useful Links:
● Java-maven-app:
https://gitlab.com/nanuchi/java-maven-app/-/blob/feature/jenkinsfile-sshagent
Check your progress... 5/9
Useful Links:
● Java-maven-app:
https://gitlab.com/nanuchi/java-maven-app/-/blob/feature/jenkinsfile-sshagent
● Docker-Compose Download (AWS and Jenkins Part II):
https://docs.docker.com/compose/install/
Useful Links:
● Java-maven-app - sshagent:
https://gitlab.com/nanuchi/java-maven-app/-/blob/feature/jenkinsfile-sshagent
● Java-maven-app - version increment:
https://gitlab.com/nanuchi/java-maven-app/-/tree/jenkins-jobs/Jenkinsfile-version
-increment
Check your progress... 6/9
Useful Links:
Useful commands:
## this will give output of created my-sg with its id, so we can do:
aws ec2 describe-security-groups --group-ids sg-903004f8
# Use an existing key-value pair or if you want, create and use a new key-pair. 'KeyMaterial' gives
us an unencrypted PEM encoded RSA private key.
aws ec2 create-key-pair --key-name MyKeyPair --query 'KeyMaterial' --output text > MyKeyPair.pem
# ssh into the ec2 instance with the new key pem after creating it - public IP will be returned as
json, so query it
aws ec2 describe-instances --instance-ids {instance-id}
chmod 400 MyKeyPair.pem
ssh -i MyKeyPair.pem ec2-user@public-ip
Useful commands:
# same way as ec2 had a bunch of commands for components relevant for ec2 instances, iam does too
aws iam create-group --group-name MyIamGroup
aws iam create-user --user-name MyUser
aws iam add-user-to-group --user-name MyUser --group-name MyIamGroup
# Now that user needs access to the command line and UI, but we didn't give it any credentials. So
let's do that as well!
## UI access
aws iam create-login-profile --user-name MyUser --password My!User1Login8P@ssword
--password-reset-required
-> user will have to update password on UI or programmatically with command: aws iam
update-login-profile --user-name MyUser --password My!User1ADifferentP@ssword
## cli access
aws iam create-access-key --user-name MyUser
-> you will see the access keys
Check your progress... 9/9
Useful commands:
## Now let's ssh into the EC2 instance with this user
'aws configure' with new user creds
export AWS_ACCESS_KEY_ID=AKIAIOSFODNN7EXAMPLE
export AWS_SECRET_ACCESS_KEY=wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
export AWS_DEFAULT_REGION=us-west-2
## Now let's login with this user on UI and see what got created!
Best practices
● IAM best practices:
https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html
● VPC best practices:
https://docs.aws.amazon.com/vpc/latest/userguide/vpc-security-best-practices
.html
● EC2 best practices:
https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-best-practices.h
tml
● Keep your .pem file in the “standard” location in .ssh directory in your $HOME.
I.e. /Users/$USER/.ssh/. You should protect this directory with permission 400
● You should not share these .pem files with your co-workers. Each user should
generate their own SSH keypair and their public key should be deployed to
each system they need access to. Private keys should be private to each user,
generated by them.