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

0

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

wynter
已提問 2 個月前檢視次數 123 次
1 個回答
0

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"
profile picture
專家
已回答 2 個月前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南