Skip to content

Instantly share code, notes, and snippets.

@dabit3
Last active February 4, 2021 13:35
Show Gist options
  • Save dabit3/1308812f6780d1735e3313487819c7fa to your computer and use it in GitHub Desktop.
Save dabit3/1308812f6780d1735e3313487819c7fa to your computer and use it in GitHub Desktop.
Dealing with Chime SDK for creating rooms & attendees
/* On the server */
const AWS = require('aws-sdk')
const chime = new AWS.Chime({ region: 'us-east-1' })
// create a room
const meeting = await chime.createMeeting({
ClientRequestToken: uuid(),
MediaRegion: 'us-east-1'
}).promise()
// add an attendee to a room
const attendeeResponse = await chime.createAttendee({
MeetingId: meetingId,
ExternalUserId: 'some-unique-subject-id'
}).promise()
// get a room
const room = await chime.getMeeting({
MeetingId: meetingId
}).promise()
// remove a user from a room
await chime.deleteAttendee({
MeetingId: meetingId,
AttendeeId: attendeeId
}).promise()
// close a room
await chime.deleteMeeting({ MeetingId: meetingId })
.promise()
@omenking
Copy link

omenking commented Feb 4, 2021

The Lambda you use for the Chime SDK is likely these IAM permissions.

I recommend avoiding doing chime:*.

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Effect": "Allow",
            "Action": [
                "chime:DeleteMeeting",
                "chime:BatchCreateAttendee",
                "chime:CreateAttendee",
                "chime:ListAttendees",
                "chime:GetMeeting",
                "chime:GetAttendee",
                "chime:CreateMeetingDialOut",
                "chime:DeleteAttendee"
            ],
            "Resource": "arn:aws:chime::*:meeting/*"
        },
        {
            "Sid": "VisualEditor1",
            "Effect": "Allow",
            "Action": [
                "chime:ListMeetings",
                "chime:CreateBot",
                "chime:UpdateRoom",
                "chime:CreateRoom",
                "chime:CreateMeetingWithAttendees",
                "chime:UpdateBot",
                "chime:GetRoom",
                "chime:CreateBotMembership",
                "chime:CreateMeeting",
                "chime:GetMeetingDetail",
                "chime:GetUser"
            ],
            "Resource": "*"
        }
    ]
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment