0
# Pulumi AWS Provider
1
2
The Pulumi AWS Provider (`@pulumi/aws`) is a comprehensive infrastructure-as-code library that enables programmatic management of Amazon Web Services (AWS) resources. It provides a complete bridge to AWS APIs through strongly-typed interfaces, supporting over 225 AWS services with 2,157+ resource and data source types across multiple programming languages.
3
4
## Package Information
5
6
- **Package Name**: @pulumi/aws
7
- **Package Type**: npm (also available for Python, Go, Java, .NET)
8
- **Language**: TypeScript/JavaScript (primary SDK)
9
- **Installation**: `npm install @pulumi/aws`
10
- **Version**: 7.6.0
11
- **AWS Services Supported**: 225+ services
12
- **Total Resources**: 2,157+ resource and data source types
13
14
## Core Imports
15
16
```typescript
17
import * as aws from "@pulumi/aws";
18
import { Provider } from "@pulumi/aws";
19
```
20
21
For specific service modules:
22
23
```typescript
24
import * as ec2 from "@pulumi/aws/ec2";
25
import * as s3 from "@pulumi/aws/s3";
26
import * as lambda from "@pulumi/aws/lambda";
27
import * as iam from "@pulumi/aws/iam";
28
```
29
30
CommonJS:
31
32
```javascript
33
const aws = require("@pulumi/aws");
34
const { Provider } = require("@pulumi/aws");
35
```
36
37
## Basic Usage
38
39
```typescript
40
import * as aws from "@pulumi/aws";
41
42
// Configure the AWS provider
43
const provider = new aws.Provider("aws-provider", {
44
region: "us-west-2",
45
profile: "my-profile"
46
});
47
48
// Create an S3 bucket
49
const bucket = new aws.s3.Bucket("my-bucket", {
50
bucket: "my-unique-bucket-name",
51
acl: "private"
52
}, { provider });
53
54
// Create an EC2 instance
55
const instance = new aws.ec2.Instance("my-instance", {
56
instanceType: "t3.micro",
57
ami: "ami-0c55b159cbfafe1d0",
58
tags: {
59
Name: "MyInstance"
60
}
61
}, { provider });
62
63
// Query existing resources
64
const availabilityZones = aws.getAvailabilityZones({});
65
const currentRegion = aws.getRegion({});
66
```
67
68
## Architecture
69
70
The Pulumi AWS Provider is built around several key architectural patterns:
71
72
- **Service Modules**: Each AWS service (EC2, S3, Lambda, etc.) is represented as a separate module with consistent API patterns
73
- **Resource Classes**: AWS resources are modeled as Pulumi CustomResource classes with strongly-typed properties
74
- **Data Source Functions**: Query functions for retrieving information about existing AWS resources
75
- **Provider Configuration**: Centralized AWS configuration including authentication, regions, and global settings
76
- **Type Safety**: Complete TypeScript definitions for all AWS resource properties and parameters
77
- **Lazy Loading**: Performance optimization through on-demand module loading
78
- **Multi-Language Support**: Consistent API across TypeScript, Python, Go, Java, and .NET SDKs
79
80
## Capabilities
81
82
### Provider Configuration
83
84
Central configuration for AWS authentication, regions, endpoints, and global settings. Essential for connecting to AWS and managing provider behavior.
85
86
```typescript { .api }
87
class Provider extends pulumi.ProviderResource {
88
constructor(name: string, args?: ProviderArgs, opts?: pulumi.ResourceOptions);
89
90
readonly accessKey?: pulumi.Output<string>;
91
readonly secretKey?: pulumi.Output<string>;
92
readonly region?: pulumi.Output<string>;
93
readonly profile?: pulumi.Output<string>;
94
}
95
96
interface ProviderArgs {
97
accessKey?: pulumi.Input<string>;
98
secretKey?: pulumi.Input<string>;
99
region?: pulumi.Input<string>;
100
profile?: pulumi.Input<string>;
101
assumeRole?: pulumi.Input<ProviderAssumeRole>;
102
defaultTags?: pulumi.Input<ProviderDefaultTags>;
103
// ... 25+ additional configuration options
104
}
105
```
106
107
[Provider Configuration](./provider.md)
108
109
### Global Data Sources
110
111
Utility functions for retrieving AWS account, region, and service information that work across all AWS services.
112
113
```typescript { .api }
114
function getCallerIdentity(args?: GetCallerIdentityArgs): Promise<GetCallerIdentityResult>;
115
function getRegion(args?: GetRegionArgs): Promise<GetRegionResult>;
116
function getAvailabilityZones(args?: GetAvailabilityZonesArgs): Promise<GetAvailabilityZonesResult>;
117
118
interface GetCallerIdentityResult {
119
readonly accountId: string;
120
readonly arn: string;
121
readonly userId: string;
122
}
123
```
124
125
[Global Data Sources](./global-data-sources.md)
126
127
### Compute Services
128
129
Comprehensive compute capabilities including virtual machines, serverless functions, containers, and Kubernetes orchestration.
130
131
```typescript { .api }
132
// EC2 - Virtual machines and networking
133
class ec2.Instance extends pulumi.CustomResource {
134
constructor(name: string, args: ec2.InstanceArgs, opts?: pulumi.CustomResourceOptions);
135
readonly instanceType: pulumi.Output<string>;
136
readonly ami: pulumi.Output<string>;
137
readonly publicIp: pulumi.Output<string>;
138
}
139
140
// Lambda - Serverless functions
141
class lambda.Function extends pulumi.CustomResource {
142
constructor(name: string, args: lambda.FunctionArgs, opts?: pulumi.CustomResourceOptions);
143
readonly runtime: pulumi.Output<string>;
144
readonly handler: pulumi.Output<string>;
145
readonly code: pulumi.Output<lambda.FunctionCode>;
146
}
147
```
148
149
[Compute Services](./compute.md)
150
151
### Storage Services
152
153
Object storage, block storage, file systems, and data archival services for all storage needs.
154
155
```typescript { .api }
156
// S3 - Object storage
157
class s3.Bucket extends pulumi.CustomResource {
158
constructor(name: string, args?: s3.BucketArgs, opts?: pulumi.CustomResourceOptions);
159
readonly bucket: pulumi.Output<string>;
160
readonly arn: pulumi.Output<string>;
161
}
162
163
class s3.BucketObject extends pulumi.CustomResource {
164
constructor(name: string, args: s3.BucketObjectArgs, opts?: pulumi.CustomResourceOptions);
165
readonly bucket: pulumi.Output<string>;
166
readonly key: pulumi.Output<string>;
167
readonly source: pulumi.Output<pulumi.asset.Asset | pulumi.asset.Archive>;
168
}
169
```
170
171
[Storage Services](./storage.md)
172
173
### Database Services
174
175
Relational databases, NoSQL databases, caching systems, and data warehousing solutions.
176
177
```typescript { .api }
178
// RDS - Relational databases
179
class rds.Instance extends pulumi.CustomResource {
180
constructor(name: string, args: rds.InstanceArgs, opts?: pulumi.CustomResourceOptions);
181
readonly engine: pulumi.Output<string>;
182
readonly instanceClass: pulumi.Output<string>;
183
readonly dbName: pulumi.Output<string>;
184
}
185
186
// DynamoDB - NoSQL database
187
class dynamodb.Table extends pulumi.CustomResource {
188
constructor(name: string, args: dynamodb.TableArgs, opts?: pulumi.CustomResourceOptions);
189
readonly name: pulumi.Output<string>;
190
readonly hashKey: pulumi.Output<string>;
191
readonly attributes: pulumi.Output<dynamodb.TableAttribute[]>;
192
}
193
```
194
195
[Database Services](./database.md)
196
197
### Networking Services
198
199
Virtual private clouds, DNS, content delivery, and network connectivity services.
200
201
```typescript { .api }
202
// VPC - Virtual private cloud networking
203
class vpc.Vpc extends pulumi.CustomResource {
204
constructor(name: string, args?: vpc.VpcArgs, opts?: pulumi.CustomResourceOptions);
205
readonly cidrBlock: pulumi.Output<string>;
206
readonly defaultSecurityGroupId: pulumi.Output<string>;
207
}
208
209
// Route53 - DNS management
210
class route53.Zone extends pulumi.CustomResource {
211
constructor(name: string, args: route53.ZoneArgs, opts?: pulumi.CustomResourceOptions);
212
readonly name: pulumi.Output<string>;
213
readonly nameServers: pulumi.Output<string[]>;
214
}
215
```
216
217
[Networking Services](./networking.md)
218
219
### Security & Identity Services
220
221
Identity and access management, encryption, and security monitoring services.
222
223
```typescript { .api }
224
// IAM - Identity and access management
225
class iam.Role extends pulumi.CustomResource {
226
constructor(name: string, args: iam.RoleArgs, opts?: pulumi.CustomResourceOptions);
227
readonly name: pulumi.Output<string>;
228
readonly arn: pulumi.Output<string>;
229
readonly assumeRolePolicy: pulumi.Output<string>;
230
}
231
232
// KMS - Key management
233
class kms.Key extends pulumi.CustomResource {
234
constructor(name: string, args?: kms.KeyArgs, opts?: pulumi.CustomResourceOptions);
235
readonly keyId: pulumi.Output<string>;
236
readonly arn: pulumi.Output<string>;
237
}
238
```
239
240
[Security & Identity Services](./security.md)
241
242
### Application Services
243
244
API management, messaging, workflow orchestration, and application integration services.
245
246
```typescript { .api }
247
// API Gateway - REST and HTTP APIs
248
class apigateway.RestApi extends pulumi.CustomResource {
249
constructor(name: string, args?: apigateway.RestApiArgs, opts?: pulumi.CustomResourceOptions);
250
readonly name: pulumi.Output<string>;
251
readonly executionArn: pulumi.Output<string>;
252
}
253
254
// SNS - Simple notification service
255
class sns.Topic extends pulumi.CustomResource {
256
constructor(name: string, args?: sns.TopicArgs, opts?: pulumi.CustomResourceOptions);
257
readonly name: pulumi.Output<string>;
258
readonly arn: pulumi.Output<string>;
259
}
260
```
261
262
[Application Services](./application.md)
263
264
## Types
265
266
### Common Resource Patterns
267
268
```typescript { .api }
269
// All AWS resources extend this base class
270
abstract class pulumi.CustomResource {
271
static get(name: string, id: pulumi.Input<pulumi.ID>, state?: ResourceState): Resource;
272
static isInstance(obj: any): obj is Resource;
273
readonly urn: pulumi.Output<pulumi.URN>;
274
}
275
276
// Common argument pattern for resource constructors
277
interface ResourceArgs {
278
tags?: pulumi.Input<Tags>;
279
[property: string]: pulumi.Input<any>;
280
}
281
282
// Common state pattern for importing existing resources
283
interface ResourceState {
284
[property: string]: pulumi.Input<any>;
285
}
286
287
// Tags interface used throughout AWS resources
288
interface Tags {
289
[key: string]: pulumi.Input<string>;
290
}
291
```
292
293
### Data Source Patterns
294
295
```typescript { .api }
296
// Standard data source function signature
297
type DataSourceFunction<TArgs, TResult> = (
298
args?: TArgs,
299
opts?: pulumi.InvokeOptions
300
) => Promise<TResult>;
301
302
// Output version for use in resource properties
303
type DataSourceOutputFunction<TArgs, TResult> = (
304
args?: pulumi.Input<TArgs>,
305
opts?: pulumi.InvokeOptions
306
) => pulumi.Output<TResult>;
307
308
// Common filter pattern for data sources
309
interface DataSourceFilter {
310
name: string;
311
values: string[];
312
}
313
```
314
315
### Provider Types
316
317
```typescript { .api }
318
interface ProviderAssumeRole {
319
roleArn?: pulumi.Input<string>;
320
sessionName?: pulumi.Input<string>;
321
externalId?: pulumi.Input<string>;
322
policy?: pulumi.Input<string>;
323
tags?: pulumi.Input<{[key: string]: pulumi.Input<string>}>;
324
}
325
326
interface ProviderDefaultTags {
327
tags?: pulumi.Input<{[key: string]: pulumi.Input<string>}>;
328
}
329
```