sparse-intern-71089
08/16/2018, 9:47 AMadventurous-jordan-10043
08/16/2018, 10:00 AMadventurous-jordan-10043
08/16/2018, 10:02 AMadventurous-jordan-10043
08/16/2018, 10:03 AMthousands-microphone-24535
08/16/2018, 10:17 AMadventurous-jordan-10043
08/16/2018, 11:14 AMnew aws.serverless.Function('my-func', {
policies: ['arn:aws:iam::aws:policy/AmazonDynamoDBFullAccess']
}, () => {
console.log('hello')
})
adventurous-jordan-10043
08/16/2018, 11:15 AMaws.serverless.Function
you can quickly reference existing policies or you can even create a role with aws.iam.Role
and use the role reference with that function.thousands-microphone-24535
08/16/2018, 2:18 PMcloud.API
right? Is there a way to set policies or roles while creating a cloud.API?adventurous-jordan-10043
08/16/2018, 2:32 PM@pulumi/cloud
though, you need to set it via global configuration of the cloud-aws
package currently - you can use this:
https://github.com/pulumi/pulumi-cloud/blob/master/aws/config/index.ts#L52-L56adventurous-jordan-10043
08/16/2018, 2:34 PMcomputeIAMRolePolicyARNs
or maybe it needs to be prefixed with aws:
I'm not surethousands-microphone-24535
08/16/2018, 3:15 PMcloud-aws:computeIAMRolePolicyARNs
as I found in https://github.com/pulumi/examples/tree/master/cloud-js-thumbnailer-machine-learning#running-the-app
I’m now trying to come create a proper policy in the management console, I’m too noob with aws 😅adventurous-jordan-10043
08/16/2018, 3:21 PMthousands-microphone-24535
08/16/2018, 4:03 PMnew cloud.API
that it can access a cloud.Table
created the line before and to some cloudwatch logs.
(i’m just rumbling now… 😅)adventurous-jordan-10043
08/16/2018, 5:23 PMadventurous-jordan-10043
08/16/2018, 5:25 PMserverless.apigateway.API
in the @pulumi/serverless
package and aws.serverless.Function
in the @pulumi/aws
package.adventurous-jordan-10043
08/16/2018, 5:25 PMthousands-microphone-24535
08/16/2018, 6:24 PMconst table = new cloud.Table("table", "id");
const endpoint = new cloud.API("api");
endpoint.get('/feed', (req, res) => {
table.scan().then(posts => {
So if I can replicate that with those other classes it will be fine.adventurous-jordan-10043
08/16/2018, 6:26 PMadventurous-jordan-10043
08/16/2018, 6:27 PMthousands-microphone-24535
08/16/2018, 6:27 PMadventurous-jordan-10043
08/16/2018, 6:29 PMconst api = new serverless.apigateway.API('api', {
routes: [
{method: 'GET', path: '/events', handler: f.listEvents},
{method: 'GET', path: '/videos', handler: f.listVideos},
{method: 'GET', path: '/events/{date}', handler: f.listEventsSlots}
]
})
adventurous-jordan-10043
08/16/2018, 6:29 PMadventurous-jordan-10043
08/16/2018, 6:30 PMadventurous-jordan-10043
08/16/2018, 6:31 PMconst getPolicy = (bucketArn: string) => {
return JSON.stringify({
Version: '2012-10-17',
Statement: [{
Action: ['s3:PutObject', 's3:GetObject', 's3:ListBucket'],
Effect: 'Allow',
Resource: `${bucketArn}/*`
}]
})
}
const rolePolicy = new aws.iam.RolePolicy('upload-unauth-policy', {
role: uploadRole.id,
policy: srcBucket.arn.apply(getPolicy)
})
thousands-microphone-24535
08/16/2018, 6:31 PMthousands-microphone-24535
08/16/2018, 6:31 PMadventurous-jordan-10043
08/16/2018, 6:32 PMadventurous-jordan-10043
08/16/2018, 6:33 PMthousands-microphone-24535
08/17/2018, 10:16 AM