File tree Expand file tree Collapse file tree 7 files changed +90
-78
lines changed
content/en/ninja-workshops/6-lambda-kinesis Expand file tree Collapse file tree 7 files changed +90
-78
lines changed Original file line number Diff line number Diff line change @@ -8,6 +8,25 @@ weight: 1
88
99## Prerequisites
1010
11+ ### Note to Workshop Instructor
12+
13+ This step only needs to be completed once, as the IAM role created
14+ in this step will be shared by all workshop participants:
15+
16+ ``` bash
17+ cd ~ /workshop/lambda/iam_role
18+ terraform init
19+ terraform plan
20+ terraform apply
21+ ```
22+
23+ After the workshop is complete, cleanup the role as follows:
24+
25+ ``` bash
26+ cd ~ /workshop/lambda/iam_role
27+ terraform destroy
28+ ```
29+
1130### Observability Workshop Instance
1231The Observability Workshop uses the ` Splunk4Ninjas - Observability ` workshop template in Splunk Show,
1332which provides a pre-configured EC2 instance running Ubuntu.
Original file line number Diff line number Diff line change @@ -10,48 +10,10 @@ provider "aws" {
1010
1111
1212# Get IAM Role
13- data "aws_caller_identity" "current" {}
14- resource "aws_iam_role" "lambda_kinesis" {
13+ data "aws_iam_role" "lambda_kinesis" {
1514 name = " lambda_kinesis"
16- assume_role_policy = jsonencode ({
17- Version = " 2012-10-17"
18- Statement = [
19- {
20- Action = " sts:AssumeRole"
21- Effect = " Allow"
22- Principal = {
23- Service = " lambda.amazonaws.com"
24- }
25- }
26- ]
27- })
28- }
29- resource "aws_iam_role_policy_attachment" "lambda_kinesis_execution" {
30- role = aws_iam_role. lambda_kinesis . name
31- policy_arn = " arn:aws:iam::aws:policy/AmazonKinesisFullAccess"
3215}
3316
34- resource "aws_iam_policy" "lambda_cloudwatch_logs" {
35- name = " LambdaCloudWatchLogsCustomPolicy"
36- policy = jsonencode ({
37- " Version" : " 2012-10-17" ,
38- " Statement" : [
39- {
40- " Effect" : " Allow" ,
41- " Action" : [
42- " logs:CreateLogStream" ,
43- " logs:PutLogEvents"
44- ],
45- " Resource" : " *"
46- }
47- ]
48- })
49- }
50-
51- resource "aws_iam_role_policy_attachment" "lambda_cloudwatch_logs_attachment" {
52- role = aws_iam_role. lambda_kinesis . name
53- policy_arn = aws_iam_policy. lambda_cloudwatch_logs . arn
54- }
5517
5618# Create S3 Bucket, Ownership, ACL
5719resource "aws_s3_bucket" "lambda_bucket" {
Original file line number Diff line number Diff line change 1+ provider "aws" {
2+ region = " us-east-1"
3+
4+ default_tags {
5+ tags = {
6+ o11y-workshop = " lambda-tracing"
7+ }
8+ }
9+ }
10+
11+
12+ # Create IAM Role
13+ data "aws_caller_identity" "current" {}
14+ resource "aws_iam_role" "lambda_kinesis" {
15+ name = " lambda_kinesis"
16+ assume_role_policy = jsonencode ({
17+ Version = " 2012-10-17"
18+ Statement = [
19+ {
20+ Action = " sts:AssumeRole"
21+ Effect = " Allow"
22+ Principal = {
23+ Service = " lambda.amazonaws.com"
24+ }
25+ }
26+ ]
27+ })
28+ }
29+ resource "aws_iam_role_policy_attachment" "lambda_kinesis_execution" {
30+ role = aws_iam_role. lambda_kinesis . name
31+ policy_arn = " arn:aws:iam::aws:policy/AmazonKinesisFullAccess"
32+ }
33+
34+ resource "aws_iam_policy" "lambda_cloudwatch_logs" {
35+ name = " LambdaCloudWatchLogsCustomPolicy"
36+ policy = jsonencode ({
37+ " Version" : " 2012-10-17" ,
38+ " Statement" : [
39+ {
40+ " Effect" : " Allow" ,
41+ " Action" : [
42+ " logs:CreateLogStream" ,
43+ " logs:PutLogEvents"
44+ ],
45+ " Resource" : " *"
46+ }
47+ ]
48+ })
49+ }
50+
51+ resource "aws_iam_role_policy_attachment" "lambda_cloudwatch_logs_attachment" {
52+ role = aws_iam_role. lambda_kinesis . name
53+ policy_arn = aws_iam_policy. lambda_cloudwatch_logs . arn
54+ }
Original file line number Diff line number Diff line change 1+ terraform {
2+ required_providers {
3+ aws = {
4+ source = " hashicorp/aws"
5+ version = " ~> 5.38.0"
6+ }
7+ archive = {
8+ source = " hashicorp/archive"
9+ version = " ~> 2.4.2"
10+ }
11+ }
12+
13+ required_version = " ~> 1.2"
14+ }
15+
Original file line number Diff line number Diff line change @@ -10,48 +10,10 @@ provider "aws" {
1010
1111
1212# Get IAM Role
13- data "aws_caller_identity" "current" {}
14- resource "aws_iam_role" "lambda_kinesis" {
13+ data "aws_iam_role" "lambda_kinesis" {
1514 name = " lambda_kinesis"
16- assume_role_policy = jsonencode ({
17- Version = " 2012-10-17"
18- Statement = [
19- {
20- Action = " sts:AssumeRole"
21- Effect = " Allow"
22- Principal = {
23- Service = " lambda.amazonaws.com"
24- }
25- }
26- ]
27- })
28- }
29- resource "aws_iam_role_policy_attachment" "lambda_kinesis_execution" {
30- role = aws_iam_role. lambda_kinesis . name
31- policy_arn = " arn:aws:iam::aws:policy/AmazonKinesisFullAccess"
3215}
3316
34- resource "aws_iam_policy" "lambda_cloudwatch_logs" {
35- name = " LambdaCloudWatchLogsCustomPolicy"
36- policy = jsonencode ({
37- " Version" : " 2012-10-17" ,
38- " Statement" : [
39- {
40- " Effect" : " Allow" ,
41- " Action" : [
42- " logs:CreateLogStream" ,
43- " logs:PutLogEvents"
44- ],
45- " Resource" : " *"
46- }
47- ]
48- })
49- }
50-
51- resource "aws_iam_role_policy_attachment" "lambda_cloudwatch_logs_attachment" {
52- role = aws_iam_role. lambda_kinesis . name
53- policy_arn = aws_iam_policy. lambda_cloudwatch_logs . arn
54- }
5517
5618# Create S3 Bucket, Ownership, ACL
5719resource "aws_s3_bucket" "lambda_bucket" {
You can’t perform that action at this time.
0 commit comments