- Sign-in to AWS (Dev Account) console
- Create a user with administrative privileges in IAM
- Go to the Security credentials of the user created, and save the Access key Id and Secret Id
- Repeat step 2 and 3 by signing in to AWS(Demo Account) as well
- Install CLI from https://docs.aws.amazon.com/cli/latest/userguide/awscli-install-linux.html and run aws --version to check if the installation is done right.
- In the terminal run,
cd ~
andcd .aws
commands - Now run
aws configure
- Enter the
Access key ID
,Secret Access Key
from Dev account user credentials (From step 2 and 3) - Enter the
Default region name
(Mostly us-east-1) andOutput Format
(json
oryml
) fields aws configure --profile=dev
will create a dev profile, and repeat the step number 8.aws configure --profile=demo
will create a demo profile, and repeat the step number 8 with demo account credentials.vi config
orvi credentials
aws --profile=dev ec2 describe-vpcs
- Also, we can use
export AWS_PROFILE=dev
orexport AWS_REGION=us-east-1
and then runaws ec2 describe-vpcs
- Use
env
to verify the profile and other detail
- To create a stack :
aws cloudformation deploy --profile dev --stack-name test1 --region us-east-2 --template-file ./csye6225-infra.yml
- change
profile
andregion
parameters in the above command as per the use - To delete the stack, use the command :
aws cloudformation delete-stack --profile dev --stack-name test1 --region us-east-2
- The goal of this assignment is to: create an EC2 instance, attach the RDS instance profile to it and use the MYSQL available in the AWS.
- The flow is :
- Create3 private subnets in the existing VPC
- Created a private route table and necessary route table association for private subnets
- Created a DB subnet group referencing all 3 private subnets
- Created a EC2 security group(For RDS),which has the reference to
application security group
created in Assignment-03. It has a inbound - Create a RDS instance and attach the parameter group , subnet group and EC2 security group(For RDS) to it
- Create a policy to create, get and delete the objects and create an IAM role; Attach the policy to the newly created IAM role.
- Create a Instance profile for S3 bucket which has the reference to the S3 bucket and attach the IAM role to this profile
- Now Add the RDS Instance and S3 bucket profile to the EC2 Instance
- Create a stack
aws cloudformation deploy --profile dev --stack-name assignment5 --region us-west-2 --template-file ./csye6225-infra.yml --capabilities CAPABILITY_NAMED_IAM
- Delete a stack
aws cloudformation delete-stack --profile dev --stack-name test1 --region us-east-2
- Delete S3 Bucket
aws s3 rm s3://soumyanayar3-dev.soumyanayar.me --recursive
aws cloudformation validate-template --template-body file://Templates/csye6225-infra.yml --region us-west-2
To validate the template
- The goal of this assignment is to create a load balancer that dynamically creates the VMs or instances based on the CPU utilization.
- The launch instance will have the AMI to refer to and the user data required to create new database in the RDS instance
- An autoscaling group created will refer to the launch instance and it lives in the public subnets
- Autoscaling groups attached to the Load balancer target group helps declare instances. We can define min, max an desired number of instances
- Autoscaling policies can be attached to autoscaling group. Policy contains the rules for triggering the new or reducing the existing instance