Skip to content

How to create iCalendar String with AWS CLI for creating Resource Scheduler in AWS System Manager Quick Setup

1

I am looking to develop functionality to automate the creation of Resource Scheduler in the AWS Systems Manager Quick Setup, which was released in August.

I plan to use AWS CLI, but how can I include the required parameter, the iCalendar String? Is there a CLI command in AWS to create an iCalendar String, or if not, what are the alternative solutions?

AWS CLI Reference

asked 2 years ago553 views

1 Answer
1

Hello.

Is there a CLI command in AWS to create an iCalendar String, or if not, what are the alternative solutions?

As far as I know, I don't think there is an AWS CLI command to create an iCalendar.
When created from the management console, CloudFormation is created and the following parameters are passed as "ICalendarString".
So, how about formatting it using a bash shell etc. based on this and then passing it as a parameter to AWS CLI?

BEGIN:VCALENDAR
X-CALENDAR-TYPE:DEFAULT_CLOSED
VERSION:2.0
PRODID:-//AWS//Change Calendar 1.0//EN
BEGIN:VEVENT
UID:3e118aac-05c7-4c5d-a07d-a9a46a10451a
SEQUENCE:0
DTSTAMP:20240812T022515Z
DTSTART;TZID=Asia/Tokyo:20240812T090000
DTEND;TZID=Asia/Tokyo:20240812T170000
RRULE:FREQ=WEEKLY;INTERVAL=1;BYDAY=MO,TU,WE,TH,FR
SUMMARY:Custom start-stop schedules
END:VEVENT
END:VCALENDAR

With AWS CLI, you can execute commands in the following format.
https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ssm-quicksetup/create-configuration-manager.html

aws ssm-quicksetup create-configuration-manager --configuration-definitions \
'[{"LocalDeploymentAdministrationRoleArn": "arn:aws:iam::111111111111:role/AWS-QuickSetup-LocalAdministrationRole","LocalDeploymentExecutionRoleName": "AWS-QuickSetup-LocalExecutionRole","Parameters": {"ICalendarString": "BEGIN:VCALENDAR\nX-CALENDAR-TYPE:DEFAULT_CLOSED\r\nVERSION:2.0\r\nPRODID:-//AWS//Change Calendar 1.0//EN\r\nBEGIN:VEVENT\r\nUID:3e118aac-05c7-4c5d-a07d-a9a46a10451a\r\nSEQUENCE:0\r\nDTSTAMP:20240812T024926Z\r\nDTSTART;TZID=Asia/Tokyo:20240812T090000\r\nDTEND;TZID=Asia/Tokyo:20240812T170000\r\nRRULE:FREQ=WEEKLY;INTERVAL=1;BYDAY=MO,TU,WE,TH,FR\r\nSUMMARY:Custom start-stop schedules\r\nEND:VEVENT\r\nEND:VCALENDAR","TargetAccounts": "111111111111","TargetRegions": "ap-northeast-1","TargetTagKey": "Name","TargetTagValue": "test"},"Type": "AWSQuickSetupType-Scheduler","TypeVersion": "3.0"}]' \
--name "test"
EXPERT

answered 2 years ago

  • @riku_Kobayashi Where did you get that icalendar string? Did you just manually make it using the ical format? I tried using IaC composer and it would not let me transform SSM Quick-Start Schedules into Cloudformation.

    It worked for me by the way, thank you.

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.