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
#!/usr/bin/python | |
# -*- coding: utf-8 -*- | |
from pyspark import SparkContext | |
from pyspark.sql import SparkSession | |
from pyspark.sql.functions import * | |
from pyspark.sql.types import StringType | |
from pyspark import SQLContext | |
from itertools import islice | |
from pyspark.sql.functions import col |
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
resource "aws_iam_role" "ec2_s3_access_role" { | |
name = "s3-role" | |
assume_role_policy = "${file("assumerolepolicy.json")}" | |
} |
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
{ | |
"Version": "2012-10-17", | |
"Statement": [ | |
{ | |
"Action": "sts:AssumeRole", | |
"Principal": { | |
"Service": "ec2.amazonaws.com" | |
}, | |
"Effect": "Allow", | |
"Sid": "" |
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
resource "aws_iam_policy" "policy" { | |
name = "test-policy" | |
description = "A test policy" | |
policy = "${file("policys3bucket.json")}" | |
} |
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
{ | |
"Version": "2012-10-17", | |
"Statement": [ | |
{ | |
"Effect": "Allow", | |
"Action": "s3:*", | |
"Resource": "*" | |
} | |
] | |
} |
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
resource "aws_iam_policy_attachment" "test-attach" { | |
name = "test-attachment" | |
roles = ["${aws_iam_role.ec2_s3_access_role.name}"] | |
policy_arn = "${aws_iam_policy.policy.arn}" | |
} |
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
resource "aws_iam_instance_profile" "test_profile" { | |
name = "test_profile" | |
roles = ["${aws_iam_role.ec2_s3_access_role.name}"] | |
} |
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
resource "aws_instance" "my-test-instance" { | |
ami = "${lookup(var.AmiLinux, var.region)}" | |
instance_type = "t2.micro" | |
iam_instance_profile = "${aws_iam_instance_profile.test_profile.name}" | |
tags { | |
Name = "test-instance" | |
} | |
} |
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
variable "region" { | |
default = "us-east-1" | |
} | |
variable "AmiLinux" { | |
type = "map" | |
default = { | |
us-east-1 = "ami-b73b63a0" # Virginia | |
} | |
description = "have only added one region" | |
} |
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
FROM php:7.0-apache | |
RUN docker-php-ext-install mysqli && docker-php-ext-enable mysqli | |
#installing | |
RUN apt-get update | |
RUN apt-get install apache2 -y | |
#making /app as the working directory | |
WORKDIR /app |
OlderNewer