Skip to content

Instantly share code, notes, and snippets.

anneakin

Block or report user

Report or block anneakin

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@anneakin
anneakin / packer_provisioners.json
Created May 23, 2020
Provisioners section of Packer file
View packer_provisioners.json
"provisioners": [
{
"type": "shell",
"inline": [
"sleep 30",
"sudo yum update -y",
"sudo amazon-linux-extras install epel -y",
"sudo yum install s3fs-fuse -y"
]
}
@anneakin
anneakin / packer_builders.json
Created May 23, 2020
Builders section of Packer JSON
View packer_builders.json
"builders": [
{
"type": "amazon-ebs",
"access_key": "{{user `aws_access_key`}}",
"secret_key": "{{user `aws_secret_key`}}",
"region": "us-east-1",
"source_ami_filter": {
"filters": {
"virtualization-type": "hvm",
"name": "amzn2-ami-hvm-2.0.20200207.1-x86_64-gp2",
@anneakin
anneakin / packer_variables.json
Last active May 23, 2020
Variables section of Packer file
View packer_variables.json
"variables": {
"aws_access_key": "",
"aws_secret_key": ""
},
@anneakin
anneakin / outputs.tf
Created May 23, 2020
Terraform sandbox outputs file
View outputs.tf
output "ec2_public_ip" {
value = "${aws_instance.user_ec2_instance.public_ip}"
}
output "ec2_private_ip" {
value = "${aws_instance.user_ec2_instance.private_ip}"
}
@anneakin
anneakin / main.tf
Created May 23, 2020
Terraform resources for sandbox
View main.tf
provider "aws" {
profile = "default"
region = "us-east-1"
}
resource "aws_s3_bucket" "user_s3_bucket" {
bucket = "${var.username}-s3-bucket"
}
resource "aws_iam_role" "ec2_iam_role" {
@anneakin
anneakin / variables.tf
Created May 23, 2020
Terraform sandbox variables
View variables.tf
variable "username" {}
variable "user_key" {}
variable "subnet_id" {}
@anneakin
anneakin / aws_cfn_ec2_userdata.yml
Created May 23, 2020
EC2 Instance resource with User Data
View aws_cfn_ec2_userdata.yml
UserEc2Instance:
Type: AWS::EC2::Instance
Properties:
InstanceType: t2.micro
IamInstanceProfile: !Ref EC2IamInstanceProfile
ImageId: ami-0a887e401f7654935
KeyName: !Ref UserKey
SubnetId: !Ref Subnet
Tags:
-
@anneakin
anneakin / aws_cfn_sandbox_policy.yml
Created May 23, 2020
Policy document for EC2 IAM role
View aws_cfn_sandbox_policy.yml
PolicyName: DestinationBucketAccessPolicy
PolicyDocument:
Version: '2012–10–17'
Statement:
- Effect: Allow
Action:
- s3:ListBucket
- s3:DeleteObject
- s3:GetObject
- s3:PutObject
@anneakin
anneakin / aws_cfn_sandbox_outputs.yml
Created May 23, 2020
AWS CloudFormation Outputs
View aws_cfn_sandbox_outputs.yml
Outputs:
EC2PrivateIp:
Description: Private IP address of EC2 instance created in stack.
Value: !GetAtt UserEc2Instance.PrivateIp
EC2PublicIp:
Description: Public IP address of EC2 instance created in stack.
Value: !GetAtt UserEc2Instance.PublicIp
@anneakin
anneakin / aws_cfn_sandbox_resources.yml
Last active May 23, 2020
AWS CloudFormation Resources
View aws_cfn_sandbox_resources.yml
Resources:
UserS3Bucket:
Type: AWS::S3::Bucket
Properties:
BucketName: !Join [ '-', [ !Ref Username, 's3-bucket' ] ]
EC2IamRole:
Type: AWS::IAM::Role
Properties:
RoleName: !Join [ '-', [ !Ref Username, 'ec2-iam-role' ] ]
You can’t perform that action at this time.