Policies for AWS
AWS policy files for the StackState AWS integration

Overview

This page includes examples of all IAM and other policies necessary for a working StackState AWS Agent installation. For the AWS (Legacy) integration, refer to the policy files provided when the AWS (Legacy) StackPack is installed.
These policies are taken directly from the CloudFormation template and should be used wherever possible.
To use a template, replace the following values:
  • ${Region} - replace with the name of the region that the IAM role will be used for, such as ${Region} or us-east-1.
  • ${AccountId} - replace with the 12-digit AWS account ID of the AWS account that the resources will be deployed in.

StackStateAwsIntegrationRole

The JSON objects below contains the least-privilege IAM policy used by the AWS integration. The Assume Role Policy Document should grant the agent access. Refer to the AWS documentation for more information on setting a trust policy (aws.amazon.com).

Trust Relationship

For an AWS agent running outside of AWS, using an IAM user. Replace the Principal with the IAM user or AWS account that the agent is using.
1
{
2
"Version": "2012-10-17",
3
"Statement": [
4
{
5
"Effect": "Allow",
6
"Principal": {
7
"AWS": [
8
"arn:aws:iam::${AccountId}:root"
9
]
10
},
11
"Action": "sts:AssumeRole",
12
"Condition": {
13
"StringEquals": {
14
"sts:ExternalId": "${ExternalId}"
15
}
16
}
17
}
18
]
19
}
Copied!
For an AWS agent running on an EC2 instance:
1
{
2
"Version": "2008-10-17",
3
"Statement": [
4
{
5
"Effect": "Allow",
6
"Principal": {
7
"Service": "ec2.amazonaws.com"
8
},
9
"Action": "sts:AssumeRole"
10
}
11
]
12
}
Copied!

IAM Policy Document

1
{
2
"Version": "2012-10-17",
3
"Statement": [
4
{
5
"Action": [
6
"cloudtrail:LookupEvents",
7
"iam:ListAccountAliases"
8
],
9
"Resource": "*",
10
"Effect": "Allow",
11
"Sid": "SelfAccess"
12
},
13
{
14
"Action": [
15
"cloudwatch:GetMetricData",
16
"cloudwatch:ListMetrics"
17
],
18
"Resource": "*",
19
"Effect": "Allow",
20
"Sid": "MetricsAccess"
21
},
22
{
23
"Action": [
24
"s3:DeleteObject",
25
"s3:GetObject",
26
"s3:GetObjectVersion",
27
"s3:ListBucket"
28
],
29
"Resource": [
30
"arn:aws:s3:::stackstate-logs-${AccountId}",
31
"arn:aws:s3:::stackstate-logs-${AccountId}/*"
32
],
33
"Effect": "Allow",
34
"Sid": "EventsS3Access"
35
},
36
{
37
"Action": [
38
"ec2:DescribeInstances",
39
"ec2:DescribeInstanceTypes",
40
"ec2:DescribeSecurityGroups",
41
"ec2:DescribeSubnets",
42
"ec2:DescribeVpcs",
43
"ec2:DescribeVpnGateways"
44
],
45
"Resource": "*",
46
"Effect": "Allow",
47
"Sid": "Ec2Access"
48
},
49
{
50
"Action": [
51
"elasticloadbalancing:DescribeInstanceHealth",
52
"elasticloadbalancing:DescribeListeners",
53
"elasticloadbalancing:DescribeLoadBalancers",
54
"elasticloadbalancing:DescribeTags",
55
"elasticloadbalancing:DescribeTargetGroups",
56
"elasticloadbalancing:DescribeTargetHealth"
57
],
58
"Resource": "*",
59
"Effect": "Allow",
60
"Sid": "LoadBalancingAccess"
61
},
62
{
63
"Action": [
64
"autoscaling:DescribeAutoScalingGroups"
65
],
66
"Resource": "*",
67
"Effect": "Allow",
68
"Sid": "AutoScalingAccess"
69
},
70
{
71
"Action": [
72
"redshift:DescribeClusters"
73
],
74
"Resource": "*",
75
"Effect": "Allow",
76
"Sid": "RedshiftAccess"
77
},
78
{
79
"Action": [
80
"ecs:DescribeClusters",
81
"ecs:DescribeContainerInstances",
82
"ecs:DescribeServices",
83
"ecs:DescribeTasks",
84
"ecs:ListClusters",
85
"ecs:ListContainerInstances",
86
"ecs:ListServices",
87
"ecs:ListTasks"
88
],
89
"Resource": "*",
90
"Effect": "Allow",
91
"Sid": "EcsAccess"
92
},
93
{
94
"Action": [
95
"servicediscovery:GetNamespace",
96
"servicediscovery:GetService",
97
"servicediscovery:ListInstances",
98
"servicediscovery:ListServices"
99
],
100
"Resource": "*",
101
"Effect": "Allow",
102
"Sid": "ServiceDiscoveryAccess"
103
},
104
{
105
"Action": [
106
"firehose:DescribeDeliveryStream",
107
"firehose:ListDeliveryStreams",
108
"firehose:ListTagsForDeliveryStream"
109
],
110
"Resource": "*",
111
"Effect": "Allow",
112
"Sid": "FirehoseAccess"
113
},
114
{
115
"Action": [
116
"s3:GetBucketNotification",
117
"s3:GetBucketTagging",
118
"s3:ListAllMyBuckets",
119
"s3:ListBucket"
120
],
121
"Resource": "*",
122
"Effect": "Allow",
123
"Sid": "S3Access"
124
},
125
{
126
"Action": [
127
"rds:DescribeDBClusters",
128
"rds:DescribeDBInstances"
129
],
130
"Resource": "*",
131
"Effect": "Allow",
132
"Sid": "RdsAccess"
133
},
134
{
135
"Action": [
136
"route53:GetHostedZone",
137
"route53:ListHostedZones",
138
"route53:ListResourceRecordSets",
139
"route53:ListTagsForResource",
140
"route53domains:GetDomainDetail",
141
"route53domains:ListDomains",
142
"route53domains:ListTagsForDomain"
143
],
144
"Resource": "*",
145
"Effect": "Allow",
146
"Sid": "Route53Access"
147
},
148
{
149
"Action": [
150
"lambda:GetFunction",
151
"lambda:ListAliases",
152
"lambda:ListEventSourceMappings",
153
"lambda:ListFunctions",
154
"lambda:ListTags"
155
],
156
"Resource": "*",
157
"Effect": "Allow",
158
"Sid": "LambdaAccess"
159
},
160
{
161
"Action": [
162
"sns:GetTopicAttributes",
163
"sns:ListSubscriptionsByTopic",
164
"sns:ListTagsForResource",
165
"sns:ListTopics"
166
],
167
"Resource": "*",
168
"Effect": "Allow",
169
"Sid": "SnsAccess"
170
},
171
{
172
"Action": [
173
"sqs:GetQueueAttributes",
174
"sqs:ListQueues",
175
"sqs:ListQueueTags"
176
],
177
"Resource": "*",
178
"Effect": "Allow",
179
"Sid": "SqsAccess"
180
},
181
{
182
"Action": [
183
"dynamodb:DescribeTable",
184
"dynamodb:ListTables",
185
"dynamodb:ListTagsOfResource"
186
],
187
"Resource": "*",
188
"Effect": "Allow",
189
"Sid": "DynamoDbAccess"
190
},
191
{
192
"Action": [
193
"kinesis:DescribeStreamSummary",
194
"kinesis:ListStreams",
195
"kinesis:ListTagsForStream"
196
],
197
"Resource": "*",
198
"Effect": "Allow",
199
"Sid": "KinesisAccess"
200
},
201
{
202
"Action": [
203
"apigateway:GET"
204
],
205
"Resource": "*",
206
"Effect": "Allow",
207
"Sid": "ApiGatewayAccess"
208
},
209
{
210
"Action": [
211
"cloudformation:DescribeStackResources",
212
"cloudformation:DescribeStacks"
213
],
214
"Resource": "*",
215
"Effect": "Allow",
216
"Sid": "CloudFormationAccess"
217
},
218
{
219
"Action": [
220
"states:DescribeStateMachine",
221
"states:ListActivities",
222
"states:ListStateMachines",
223
"states:ListTagsForResource"
224
],
225
"Resource": "*",
226
"Effect": "Allow",
227
"Sid": "StepFunctionsAccess"
228
}
229
]
230
}
Copied!

StackStateEventBridgeRole-${Region}

Trust Relationship

1
{
2
"Version": "2008-10-17",
3
"Statement": [
4
{
5
"Effect": "Allow",
6
"Principal": {
7
"Service": "events.amazonaws.com"
8
},
9
"Action": "sts:AssumeRole"
10
}
11
]
12
}
Copied!

IAM Policy Document

Replace the Resource with the ARN of the target Kinesis Firehose Delivery Stream.
1
{
2
"Statement": [
3
{
4
"Action": [
5
"firehose:PutRecord",
6
"firehose:PutRecordBatch"
7
],
8
"Resource": [
9
"arn:aws:firehose:${Region}:${AccountId}:deliverystream/stackstate-eventbridge-stream"
10
],
11
"Effect": "Allow"
12
}
13
]
14
}
Copied!

StackStateFirehoseRole-${Region}

Trust Relationship

1
{
2
"Version": "2008-10-17",
3
"Statement": [
4
{
5
"Effect": "Allow",
6
"Principal": {
7
"Service": "firehose.amazonaws.com"
8
},
9
"Action": "sts:AssumeRole"
10
}
11
]
12
}
Copied!

IAM Policy Document

The Condition and KMS sections are only needed if a KMS key is used. This assumes that the S3 bucket is named stackstate-logs-${AccountId}
1
{
2
"Statement": [
3
{
4
"Action": [
5
"s3:AbortMultipartUpload",
6
"s3:GetBucketLocation",
7
"s3:GetObject",
8
"s3:ListBucket",
9
"s3:ListBucketMultipartUploads",
10
"s3:PutObject",
11
"s3:PutObjectAcl"
12
],
13
"Resource": [
14
"arn:aws:s3:::stackstate-logs-${AccountId}/AWSLogs/${AccountId}/EventBridge/${Region}/*",
15
"arn:aws:s3:::stackstate-logs-${AccountId}"
16
],
17
"Effect": "Allow"
18
},
19
{
20
"Condition": {
21
"StringEquals": {
22
"kms:ViaService": "s3.${Region}.amazonaws.com"
23
},
24
"ArnLike": {
25
"kms:EncryptionContext:aws:s3:arn": "arn:aws:s3:::stackstate-logs-${AccountId}/AWSLogs/${AccountId}/EventBridge/${Region}/*"
26
}
27
},
28
"Action": [
29
"kms:Decrypt",
30
"kms:GenerateDataKey"
31
],
32
"Resource": [
33
"arn:aws:kms:${Region}:${AccountId}:alias/stackstate-integration"
34
],
35
"Effect": "Allow"
36
}
37
]
38
}
Copied!

StsEventBridgeRule

1
{
2
"detail-type": [
3
"EC2 Instance State-change Notification",
4
"AWS API Call via CloudTrail"
5
],
6
"source": [
7
"aws.apigateway",
8
"aws.application-autoscaling",
9
"aws.dynamodb",
10
"aws.ec2",
11
"aws.ecs",
12
"aws.elasticloadbalancing",
13
"aws.firehose",
14
"aws.kinesis",
15
"aws.lambda",
16
"aws.rds",
17
"aws.redshift",
18
"aws.s3",
19
"aws.sqs",
20
"aws.states"
21
]
22
}
Copied!

stackstate-integration KMS Key

By default this KMS key gives full access to any IAM user within the account to administer the key. This can be modified as necessary to meet your organization's security policies.
1
{
2
"Version": "2012-10-17",
3
"Id": "default",
4
"Statement": [
5
{
6
"Sid": "AllowKeyAdministration",
7
"Effect": "Allow",
8
"Principal": {
9
"AWS": [
10
"arn:aws:iam::${AccountId}:root"
11
]
12
},
13
"Action": [
14
"kms:Create*",
15
"kms:Describe*",
16
"kms:Enable*",
17
"kms:List*",
18
"kms:Put*",
19
"kms:Update*",
20
"kms:Revoke*",
21
"kms:Disable*",
22
"kms:Get*",
23
"kms:Delete*",
24
"kms:TagResource",
25
"kms:UntagResource",
26
"kms:ScheduleKeyDeletion",
27
"kms:CancelKeyDeletion"
28
],
29
"Resource": "*"
30
},
31
{
32
"Sid": "AllowS3Access",
33
"Effect": "Allow",
34
"Principal": {
35
"AWS": "*"
36
},
37
"Action": [
38
"kms:Decrypt",
39
"kms:DescribeKey",
40
"kms:Encrypt",
41
"kms:GenerateDataKey*",
42
"kms:ReEncrypt*"
43
],
44
"Resource": "*",
45
"Condition": {
46
"StringEquals": {
47
"kms:ViaService": "s3.${Region}.amazonaws.com"
48
}
49
}
50
},
51
{
52
"Sid": "AllowVpcFlowLogAccess",
53
"Effect": "Allow",
54
"Principal": {
55
"Service": "delivery.logs.amazonaws.com"
56
},
57
"Action": [
58
"kms:Decrypt",
59
"kms:DescribeKey",
60
"kms:Encrypt",
61
"kms:GenerateDataKey*",
62
"kms:ReEncrypt*"
63
],
64
"Resource": "*"
65
}
66
]
67
}
Copied!
Last modified 11d ago