This file contains hidden or 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
| sudo apt-get install python3-pip | |
| sudo pip3 install awscli | |
| function install_kops { | |
| if [ -z $(which kops) ] | |
| then | |
| curl -LO https://github.com/kubernetes/kops/releases/download/$(curl -s https://api.github.com/repos/kubernetes/kops/releases/latest | grep tag_name | cut -d '"' -f 4)/kops-linux-amd64 | |
| chmod +x kops-linux-amd64 | |
| mv kops-linux-amd64 /usr/local/bin/kops | |
| else |
This file contains hidden or 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
| resource "aws_route53_zone" "newtech-academy" { | |
| name = "newtech.academy" | |
| } | |
| resource "aws_route53_record" "server1-record" { | |
| zone_id = "${aws_route53_zone.newtech-academy.zone_id}" | |
| name = "server1.newtech.academy" | |
| type = "A" | |
| ttl = "300" | |
| records = ["104.236.247.8"] | |
| } |
This file contains hidden or 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
| variable "AWS_ACCESS_KEY" {} | |
| variable "AWS_SECRET_KEY" {} | |
| variable "AWS_REGION" { | |
| default = "eu-west-1" | |
| } | |
| variable "AMIS" { | |
| type = "map" | |
| default = { |
This file contains hidden or 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
| resource "aws_instance" "example" { | |
| ami = "${lookup(var.AMIS, var.AWS_REGION)}" | |
| instance_type = "t2.micro" | |
| # the VPC subnet | |
| subnet_id = "${aws_subnet.main-public-1.id}" | |
| # the security group | |
| vpc_security_group_ids = ["${aws_security_group.allow-ssh.id}"] |
This file contains hidden or 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
| resource "aws_key_pair" "mykeypair" { | |
| key_name = "mykeypair" | |
| public_key = "${file("${var.PATH_TO_PUBLIC_KEY}")}" | |
| } |
This file contains hidden or 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
| provider "aws" { | |
| region = "${var.AWS_REGION}" | |
| access_key = "${var.AWS_ACCESS_KEY}" | |
| secret_key = "${var.AWS_SECRET_KEY}" | |
| } |
This file contains hidden or 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
| data "aws_ip_ranges" "european_ec2" { | |
| regions = [ | |
| "eu-west-1", | |
| "eu-central-1" | |
| ] | |
| services = [ | |
| "ec2" | |
| ] | |
| } |
This file contains hidden or 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
| # nat gw | |
| resource "aws_eip" "nat" { | |
| vpc = true | |
| } | |
| resource "aws_nat_gateway" "nat-gw" { | |
| allocation_id = "${aws_eip.nat.id}" | |
| subnet_id = "${aws_subnet.main-public-1.id}" | |
| depends_on = ["aws_internet_gateway.main-gw"] | |
| } |
This file contains hidden or 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
| # Internet VPC | |
| resource "aws_vpc" "main" { | |
| cidr_block = "10.0.0.0/16" | |
| instance_tenancy = "default" | |
| enable_dns_support = "true" | |
| enable_dns_hostnames = "true" | |
| enable_classiclink = "false" | |
| tags { | |
| Name = "main" | |
| } |
This file contains hidden or 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
| from textblob import TextBlob | |
| # compute sentiment scores (polarity) and labels | |
| sentiment_scores_tb = [round(TextBlob(article).sentiment.polarity, 3) for article in news_df['clean_text']] | |
| sentiment_category_tb = ['positive' if score > 0 | |
| else 'negative' if score < 0 | |
| else 'neutral' | |
| for score in sentiment_scores_tb] |
NewerOlder