Skip to content

Instantly share code, notes, and snippets.

View 100daysofdevops's full-sized avatar
🎯
Focusing

100daysofdevops

🎯
Focusing
View GitHub Profile
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "VisualEditor0",
"Effect": "Allow",
"Action": [
"logs:CreateLogStream",
"logs:PutLogEvents"
],
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "VisualEditor0",
"Effect": "Deny",
"Action": "cloudtrail:StopLogging",
"Resource": "arn:aws:cloudtrail:us-west-2:123456789:trail/mytestcloudtrail"
}
]
provider "aws" {
region = "us-west-2"
}
resource "aws_s3_bucket_policy" "b" {
bucket = "mytests3bucket"
policy = <<POLICY
{
"Version": "2012-10-17",
"Id": "MYBUCKETPOLICY",
{
"Id": "Policy1550810272864",
"Version": "2012-10-17",
"Statement": [
{
"Sid": "Stmt1550810271230",
"Action": [
"s3:GetObject",
"s3:PutObject"
{
"Id": "Policy1550810272864",
"Version": "2012-10-17",
"Statement": [
{
"Sid": "Stmt1550810271230",
"Action": [
"s3:GetObject",
"s3:PutObject"
provider "aws" {
region = "us-west-2"
}
resource "aws_iam_user" "my-user" {
name = "my-test-user"
}
resource "aws_iam_policy" "t2-instance-restricition-policy" {
name = "t2-instance-restricition-policy"
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "VisualEditor0",
"Effect": "Allow",
"Action": [
"ec2:RunInstances",
"ec2:GetConsoleScreenshot"
],
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "VisualEditor0",
"Effect": "Allow",
"Action": [
"ec2:RunInstances",
"ec2:GetConsoleScreenshot"
],
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": "s3:ListAllMyBuckets",
"Resource": "*"
},
{
"Effect": "Allow",
{
"Version": "2012-10-17",
"Statement": {
"Effect": "Allow",
"Action": "sts:AssumeRole",
"Resource": "arn:aws:iam::PRODUCTION-ACCOUNT-ID:role/UpdateApp" <-- Update the IAM Role we created for Account A
}
}