Latest Update Graded A+
Audit Log Retention Period?
90 days
Setting Audit Log Retention Period. By default, Audit logs are retained for 90 days. You can configure
log retention for up to 365 days.
You have recently joined the Site Reliability team at a new company and find out their most heavily
used application utilizes immutable instances within the Web tier. During a cursory review of the
monitoring dashboard you notice 1 of the 11 instances appears to be unhealthy. What is the first
action you would perform in an attempt to resolve this issue?
A. Connect to the server via SSH and view the contents of the file /var/log/messages
B. Stop the instance, wait 5 minutes, then start the instance back up
C. Terminate the instance and replace it using the appropriated image
D. Resign immediately, this job isn't going to be any fun
C. Terminate the instance and replace it using the appropriated image.
This action is possible when using and immutable infrastructure.
OCI CLI is all about task automation. Automating Simple, repeatable actions
Mutable
Bash / PowerShell scripting
Procedural (DO this, DO this, Do this, Done)
Client only
Memorize
Chef and Ansible is about configuration management, Managing app deployment and configuration
Mutable
YAML
Procedural (DO this, DO this, Do this, Done)
Client/Server (Chef) Client only (Ansible)
Memorize
Terraform is all about orchestration and infrastructure provisioning. Creating / destroying complex
application architectures
Immutable
HCL / JSON
Declarative (Here is the stuff that I need, YOU GO figure it out. When you are done it should look like
this)
Client only
Memorize
Your team as recently deployed a custom Java application to a collection of 10 OCI Compute
instances. The application is only used 10 hours each day. To save money, you devise a plan to stop
the instances at the end of the day when they are no longer needed, and start them each morning
shortly before they will be used.
,Which tool would provide the easiest method to help implement this plan?
A. Write a custom application using the Java SDK.
B. Use the CLI Command Line Interface.
C. Hire an intern to start and stop resources in the OCI Management Console each day.
D. Use Terraform.
Since the key point is "easiest" the answer is B. Use the OCI Command Line Interface, oci compute
start and stop command.
CLI RC shortcuts
- The oci_cli_rc creates shortcuts and command abbreviations
- Can be used to set default compartment per CLI profile
Setup is simple: oci setup oci-cli-rc
Some of the section included:
[OCI_CLI_CANNED_QUERIES]
(we can define queries here, see queries details in the next card)
[OCI_CLI_COMMAND_ALIASES]
rm = os.object.delete (abbreviation of object delete)
[OCI_CLI_PARAM_ALIASES]
--cid = --compartment-id (create your own shortcuts)
CLI --query option to get data with a specific columns:
oci compute image list --query "data [*].{ImageName:\"display-name\", OCID:id}" --output table
Filter for Oracle-Linux:
oci compute image list --query "data [?contains(\"display-name\", 'Oracle-Linux')].
{ImageName:\"display-name\", OCID:id}" --output table
Command Line Infrastruture (21m) at minute 7:09
OCI CLI JSON input templates
To create a template shell into which you may configure specific values used the following command.
oci compute instance launch --generate-full-command-json-input > compute_template.json
This is great for creating resource templates such as a development compute instance.
To use the file you need to do:
oci compute instance launch --from-json file://compute_template.json
Examples of how to ue OCI CLI
Copy to/from Object Storage using CLI
Automatically use multi-part downloads (GET) for faster transfer. You can, however, control the chunk
size and parallelism:
, oci os object get -bn MyBucket --file My10Gfile --part-size 1024 -multipart-download-threshold 1024
Automatically use multi-part for uploads (PUT). You can control the parameters, or disable it if you
choose:
oci os object put -bn MyBucket --file My10Gfile --part-size 512 --parallel-upload-count 5
- Without multipart option
oci os object put -bn MyBucket --file My10Gfile --no-multipart
As part of your daily tasks, you deploy 5-10 dev. instances on OCI for the engineering team. All
instances have the same config. parameters. What CLI feature could you use to simplify the
deployment process?
A. Use the CLI to generate-full-command-json-input and fill in the details of the template.
B. Download and use a macro recording tool for your browser. Record the steps to log in and deploy
the instance.
C. Use the command oci compute instance launch --use-last-configuration
D. Use the --query feature
A. Use the CLI to generate the template.
Which command will you use to upload a 5GB file to Obejcto Storage using the Command Line
Interface as a single part?
A. oci os object get -bn MyBucket --name MyObject --file Myfile.txt
B. oci os object put -bn MyBucket --name MyObject --file Myfile.txt --part-size 512
C. oci os object put -bn MyBucket --name MyObject --file Myfile.txt --no-multipart
D. oci os object upload -bn MyBucket --name MyObject --file Myfile.txt
C. oci os object put -bn MyBucket --name MyObject --file Myfile.txt --no-multipart
With --no-multipart the default option to automatic multipart upload from CLI will be disabled.
Why Infrastructure as Code
- Define end state, let the tool manage it for you
- Self-documenting infrastructure
- Consistent and repeatable results
- Increase efficiency while reducing risk
Infrastructure as Code Definition
Terraform Configuration Files - OCI provider, you need to specify the following:
Tenancy_OCID
User_OCID
Fingerprint
Private_key_path
Region
If you want to use a OCI Resource Principals you need to specify the following:
Auth ("InstancePrincipal")