Amazon Cloud - GradedJestRisk/cicd-training GitHub Wiki
Overview:
- Amazon Web Services
- provides on-demand cloud computing platforms to individuals, companies and governments, on a paid subscription basis.
General:
- Elastic Compute Cloud
- allowing users to rent virtual computers on which to run their own computer application
Overview:
Overview:
- create web app in EBS;
- create redis in EC;
- create postgres in RDS;
- create security group on default VPC;
- assign security group to EBS/EC/RDS.
- allow containers to know which ports/accounts to use by storing them in environment variable in EBS
- create access keys in IAM
- add them to Travis CI as environment variables (AWS_ACCESS_KEY, AWS_SECRET_KEY)
- add deploy section in .travis.yml
- trigger build
- EBS: check instance status and Logs / Last 100 lines
- get URL and try it
- modify app and check if redeployed succesfully
{
"AWSEBDockerrunVersion": 2,
"containerDefinitions": [
{
"name": "client",
"image": "stephengrider/multi-client",
"hostname": "client",
"essential": false,
"memory": 128
},
{
"name": "server",
"image": "stephengrider/multi-server",
"hostname": "api",
"essential": false,
"memory": 128
},
{
"name": "worker",
"image": "stephengrider/multi-worker",
"hostname": "worker",
"essential": false,
"memory": 128
},
{
"name": "nginx",
"image": "stephengrider/multi-nginx",
"hostname": "nginx",
"essential": true,
"portMappings": [
{
"hostPort": 80,
"containerPort": 80
}
],
"links": ["client", "server"],
"memory": 128
}
]
}
Clean-up :
- delete EBS application;
- RDS: Instance, select and Delete - no final snapshot
- delete ECS
- delete 3 security group (multi-docker + rds)
- delete deployer user
General:
- Elastic Bean Stalk
- an orchestration service for deploying infrastructure which orchestrates various AWS services
docker-compose.yml file can't be used to run containers, because it contains build instructions, and we don't want to build anymore. EBS delegate container execution to ECS.
In instance, Software / Modify, Environment properties:
- REDIS_HOST / URL (in EC, get primary endpoint, like multi-docker(...)amazonaws.com)
- REDIS_PORT / 6379
- PGUSER / postgres
- PGPASSWORD /
- PGHOST / URL (in RDS, get primary endpoint, like multi-docker(...).rds.amazonaws.com)
- PGDATABASE / fibvalues
- PGPORT / 5432
General:
- Elastic Container Service
General:
- 1 Docker service = 1 ECS task
- to describe one service, we'll write one task definition
- to run several containers, we'll create a
Dockerrun.aws.jsonfile - this file will contains containers definitions, each container being defined with a tasks definition section
- create Dockerrun.aws.json
- create new application, with environment's platform is "Multi-container Docker"
General:
- Elastic Cache
- Redis
- good for: scale, maintenance, security
Steps:
- name (multi-docker-redis)
- redis
- node type: (cache.)t2.micro
- number of replicas: 0
- key subnet name
- check all subnets
General:
- Relational Database Service
- Postgres
- good for: automatic backups, scale, maintenance, security
Steps:
- postgres, eligible Free Tier
- key instance name (?), username (postgres), password
- check public accessibility is no
- key database name (fibvalues)
Overview:
- Virtual Private Cloud = isolated network zone
- a default one is linked to each AWS account
- security group = group of allowed network access rules (firewall)
Steps:
- Services / VPC
- Security section on left zone
- create a security group, let default VPC selected
- allow between services : TCP - Port 5432-6379, source = security group
- add this security group to EC
- add this security group to RDS (Instances, end of page => section Details / Modify - section Network and Security + Continue)
- add this security group to EBS ( enter Instance, left: Configuration, section Instances / Modify - check and Apply)
- allow for incoming outside traffic : add inbound rules
Identity Access Management
Steps:
- Left Users, Add user, name (multi-docker-deployer), programatic access, Permissions
- Attach existing policy, add all beanstalk
- Next review, Create User
- Get ID and Secret
General: - Simple Storage Service - provides object storage through a web service interface
Amazon elastic container Service for Kubernetes