-
Notifications
You must be signed in to change notification settings - Fork 4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(aws-lambda): allow placing Lambda in VPC (#598)
feat(aws-lambda): allow placing Lambda in VPC (#598) It is now possible to deploy Lambda ENIs in a VPC, so they can access private services. Fixes #580.
- Loading branch information
Showing
10 changed files
with
826 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
export * from './managed-policy'; | ||
export * from './role'; | ||
export * from './policy'; | ||
export * from './user'; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import cdk = require('@aws-cdk/cdk'); | ||
|
||
/** | ||
* A policy managed by AWS | ||
* | ||
* For this managed policy, you only need to know the name to be able to use it. | ||
* | ||
* Some managed policy names start with "service-role/", some start with | ||
* "job-function/", and some don't start with anything. Do include the | ||
* prefix when constructing this object. | ||
*/ | ||
export class AwsManagedPolicy { | ||
constructor(private readonly managedPolicyName: string) { | ||
} | ||
|
||
/** | ||
* The Arn of this managed policy | ||
*/ | ||
public get policyArn(): cdk.Arn { | ||
// the arn is in the form of - arn:aws:iam::aws:policy/<policyName> | ||
return cdk.Arn.fromComponents({ | ||
service: "iam", | ||
region: "", // no region for managed policy | ||
account: "aws", // the account for a managed policy is 'aws' | ||
resource: "policy", | ||
resourceName: this.managedPolicyName | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import cdk = require('@aws-cdk/cdk'); | ||
import { Test } from 'nodeunit'; | ||
import { AwsManagedPolicy } from '../lib'; | ||
|
||
export = { | ||
'simple managed policy'(test: Test) { | ||
const mp = new AwsManagedPolicy("service-role/SomePolicy"); | ||
|
||
test.deepEqual(cdk.resolve(mp.policyArn), { | ||
"Fn::Join": ['', [ | ||
'arn', | ||
':', | ||
{ Ref: 'AWS::Partition' }, | ||
':', | ||
'iam', | ||
':', | ||
'', | ||
':', | ||
'aws', | ||
':', | ||
'policy', | ||
'/', | ||
'service-role/SomePolicy' | ||
]] | ||
}); | ||
|
||
test.done(); | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.