Run Sirius Command in AWS
Warning: it is unadvisable to do this if you’re not comfortable with ECS, IAM and AWS networking, since it is high risk and the UI may have changed since this guide was updated
Background
Sometimes you need to run a one-off command in a real environment, such as altering a large data set. This may not be possible with migration if you need to use the effects of PHP code, for example to create a case “for real”, including generating a UID and other side effects.
To do so, you need to run an ECS task with the specific configuration.
Before you start
- Identify the fully-qualified name of the command class
- NB the class must implement
ConsoleCommand
- NB the class must implement
- If necessary, identify any arguments that need to be passed to the command class in query string format
- Not all commands will need arguments
You can check that the command runs locally in opg-sirius
:
make run-command-api COMMAND_CLASS='Your\\Command\\Class' COMMAND_ARGS='arg1=1234&arg2='
Running a Task
- Open the task definitions in the AWS console
- Find a command that uses
sirius:command:run
in its command (for exampleschedule-copy-payment-data-{environment}
) - Run the task (“Deploy” -> “Run task”)
- You will now need to apply some configuration options:
- Select the cluster for the environment you want to run the command in
- In “Networking”:
- Set the VPC
- Select the private subnets
- Select to use an existing security group, find the group “api-ecs-{environment}”, and make sure to unselect “default”
- In “Container overrides”:
- Amend the Command override to use the class and arguments that you prepared
- Click “Create” to run the task
This page was last reviewed on 17 August 2023.
It needs to be reviewed again on 14 September 2023
by the page owner #opg-sirius-develop
.
This page was set to be reviewed before 14 September 2023
by the page owner #opg-sirius-develop.
This might mean the content is out of date.