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
image: | |
name: hashicorp/terraform:light | |
entrypoint: | |
- '/usr/bin/env' | |
- 'PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin' | |
- 'AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY}' | |
- 'AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID}' | |
- 'AWS_DEFAULT_REGION=${AWS_DEFAULT_REGION}' | |
variables: |
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
import boto3 | |
iam = boto3.client('iam') | |
response = iam.detach_user_policy( | |
UserName='pythontestuser', | |
PolicyArn='arn:aws:iam::aws:policy/AmazonEC2FullAccess' | |
) | |
response = iam.delete_user( |
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
import boto3 | |
iam = boto3.client('iam') | |
response = iam.create_user( | |
UserName='pythontestuser' | |
) | |
response = iam.attach_user_policy( | |
UserName='pythontestuser', |
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
# Stops the EC2 instances | |
import boto3 | |
region = 'us-east-1' | |
instances = ['i-12345', 'i-2345'] | |
ec2 = boto3.client('ec2', region_name=region) | |
def lambda_handler(event, context): | |
ec2.stop_instances(InstanceIds=instances) | |
print('stopped your instances: ' + str(instances)) |
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
# Starts the EC2 instances | |
import boto3 | |
region = 'us-east-1' | |
instances = ['i-12345', 'i-2345'] | |
ec2 = boto3.client('ec2', region_name=region) | |
def lambda_handler(event, context): | |
ec2.start_instances(InstanceIds=instances) | |
print('started your instances: ' + str(instances)) |
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
{ | |
"Version": "2012-10-17", | |
"Statement": [ | |
{ | |
"Effect": "Allow", | |
"Action": [ | |
"logs:CreateLogGroup", | |
"logs:CreateLogStream", | |
"logs:PutLogEvents" | |
], |
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
<html> | |
<h1>Level Up In Tech</h1> | |
<p> Learning it. Labbing it. Leveling Up</p> | |
<p>This is a simple static website, built and delivered from a docker container</p> | |
<p>Visit us here: <a href="https://levelupintech.com/">Level Up In Tech</a></p> | |
</html> |
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 ubuntu | |
RUN apt-get update | |
RUN apt-get install nginx -y | |
COPY index.html /var/www/html/ | |
EXPOSE 80 | |
CMD ["nginx","-g","daemon off;"] |
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_vpc_endpoint" "s3" { | |
vpc_id = aws_vpc.My_VPC.id | |
service_name = "com.amazonaws.us-east-1.s3" | |
} | |
# associate route table with VPC endpoint | |
resource "aws_vpc_endpoint_route_table_association" "Private_route_table_association" { | |
route_table_id = aws_route_table.My_VPC_PRIVATE_route_table.id | |
vpc_endpoint_id = aws_vpc_endpoint.s3.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_iam_role" "ec2_s3_access_role" { | |
name = "ec2-s3" | |
assume_role_policy = <<EOF | |
{ | |
"Version": "2012-10-17", | |
"Statement": [ | |
{ | |
"Action": "sts:AssumeRole", | |
"Principal": { | |
"Service": "ec2.amazonaws.com" |
NewerOlder